Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for multipart upload and custom form data #15

Open
riderx opened this issue Nov 4, 2024 · 1 comment
Open

Add support for multipart upload and custom form data #15

riderx opened this issue Nov 4, 2024 · 1 comment

Comments

@riderx
Copy link
Contributor

riderx commented Nov 4, 2024

Right now the plugin only support binary upload, would be nice to have multipart as well

@Saqib92
Copy link

Saqib92 commented Nov 11, 2024

I have Found a temporary solution for formData() usage:


const fileUrl = await CameraPreview.stopRecordVideo();
console.log(fileUrl); // your file URL

let myFileAsBlob:any = Capacitor.convertFileSrc(`file://${fileUrl.videoFilePath}`);    
let finalFile:any = await fetch(myFileAsBlob).then(r => r.blob());
console.log(finalFile);

finalFile.name = Date.now() + '.' + finalFile.type.split('/')[1];
console.log(finalFile); // file as blob with name and type

const formData = new FormData();
formData.append('YourServerFileKey, finalFile); // upload to your server.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants