<%_ if (position === 'import') { _%>
  <%_ if (clientTheme === 'vben' && clientFramework === 'vue') { _%>
import { UploadFileParams } from '@/types/axios';
import { pickBy } from 'lodash-es';
  <%_ } _%>
<%_ } _%>
<%_ if (position === 'method') { _%>
  <%_ if (clientTheme === 'vben' && clientFramework === 'vue') { _%>
  create(uploadImage: IUploadImage, onUploadProgress?: (progressEvent: ProgressEvent) => void) {
    const params: UploadFileParams = <UploadFileParams>{};
    params.name = 'image';
    params.file = uploadImage.uploadFile as File;
    if (uploadImage.filename) {
      params.filename = uploadImage.filename;
    } else {
      params.filename = uploadImage!.uploadFile!.name;
    }
    const newUploadImage = { ...uploadImage };
    delete newUploadImage.uploadFile;
    params.data = { uploadImageDTO: pickBy(newUploadImage, value => !!value) };
    return defHttp.uploadFile<IUploadImage>(
      {
        url: `${apiUrl}`,
        onUploadProgress,
      },
      params,
      { isReturnResponse: true },
    );
  },
  uploadImageUrl: apiUrl,
  <%_ } _%>
  <%_ if (clientTheme === 'antd' && clientFramework === 'react') { _%>

export async function uploadImage(params: UploadFileParams, onUploadProgress: (progressEvent: ProgressEvent) => void) {
  return request<IUploadImage>(`${apiUrl}`, { method: 'POST', requestType: 'form', data: params});
}
  <%_ } _%>
<%_ } _%>
