Open segun-flexible opened 8 months ago
You can submit form data something like this :
export const uploadBackground = async (url: string, file: string, data: any) => {
return backgroundUpload(CONFIG.API_URL + url, file, {
uploadType: UploadType.MULTIPART,
httpMethod: UploaderHttpMethod.POST,
fieldName: 'myFile',
mimeType: getMimeType(file),
parameters: data, // This is nothing but your other data apart from image
headers: {
Authorization: 'Bearer ' + Storage.get('TOKEN')
}
});
};
Is there any way to upload multiple files (videos and images)? Along with data as parameters
am requesting if there is a way take advantage of the background upload, instead of upload passing fileUri, we can just pass in formData which we have append all data we want to send to the backend.
am currently using axios, but there is no way i can leverage the backrgound upload const result = await axios({ url: "/api/user/post", method: "POST", data: formData, headers: { 'Content-Type': 'multipart/form-data' } }, onUploadProgress);
const uploadResult = await backgroundUpload( url, fileUrl, { uploadType: UploadType.MULTIPART, httpMethod: 'POST', headers }, (written, total) => { console.log(written, total); } );