<%_ if (position === 'import') { _%>
  <%_ if (clientTheme === 'vben' && clientFramework === 'vue') { _%>
import { UploadFileParams } from '@/types/axios';
  <%_ } _%>
<%_ } _%>
<%_ if (position === 'method') { _%>
  <%_ if (clientTheme === 'vben' && clientFramework === 'vue') { _%>
  create(uploadFile: IUploadFile, onUploadProgress?: (progressEvent: ProgressEvent) => void, success?) {
    const params: UploadFileParams = <UploadFileParams>{};
    params.name = 'file';
    params.file = uploadFile.file as File;
    params.filename = uploadFile!.file!.name;
    const newUploadFile = { ...uploadFile };
    delete newUploadFile.file;
    params.data = { uploadFileDTO: _pickBy(newUploadFile, value => !!value) };
    return defHttp.uploadFile<IUploadFile>(
      {
        url: `${apiUrl}`,
        onUploadProgress,
      },
      params,
      { isReturnResponse: true, success },
    );
  },
  uploadFileUrl: apiUrl,
  <%_ } _%>
  <%_ if (clientTheme === 'antd' && clientFramework === 'react') { _%>

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