i'v been looking for a solution for this issue for a week now, tried a lot of stuff nothing worked for me, I'm working on a project with react-native built on expo, what i'm trying to do is uploading an image using Imagepicker, i tried submitting it using axios and fetch, i'm able to send text data like (username, email ...) but can't send a file to the server, it doesn't recognise it a all, all it gives me is [object object], if any body was successful on doing that with php please share piece of your code, I did tried the backend with an html form and the file uploaded with no issues.
let picker = await ImagePicker.launchImageLibraryAsync({ base64: true });
const picker = selectedImage.base64;
This will return a base64 encoded image data, all you have to do is send it as a text field to the php server, decode it and put it into a file like this:
file_put_contents("example.jpg", base64_decode($_POST['image']));
And yeah, it's working
the simplest solutions is to use the base64 image format.
You can set in the options bese64 to true:
let picker = await ImagePicker.launchImageLibraryAsync({ base64:true });
And append the value in a classic json object and avoid the multipar/fomr-data, just for php decode the base64 image.