Select and upload a file as formData ionic

Hello,
i have been stuck for days now
i would like to choose file from phone, and send it as FormData
i have tried the Chooser plugin but i can’t transform the result to a file
what can i do ?
thanks

What have you tried?

i did’t know what to try… i selected files using the Chooser, extracted the URI and tried to transform it to a file but faild

Pass the file as a base64 string then append it to your formData

1 Like

Pass the file as a base64 string
any idea about how to do this, ?
i’m kind of new to this
thank you

From ionic doc under the camera plugin

this.camera.getPicture(options).then((imageData) => {
 // imageData is either a base64 encoded string or a file URI
 // If it's base64 (DATA_URL):
 let base64Image = 'data:image/jpeg;base64,' + imageData;
}, (err) => {
 // Handle error
});