Request network error when sending images to the server (android only)

54 views Asked by At

I'm getting the error Request network error when i try to send images to my server, this happens only on android, iOS is working fine. Here's my code, and the appended formData that i'm sending to my server:

const formData = new FormData();
const filename = image.uri.substring(image.uri.lastIndexOf("/") + 1);

formData.append("file", {
    uri: image.uri,
    name: filename,
    type: mime.getType(image.uri),
});

This is the formData

"file",
Object {
    "name": "5f9ed62a-6e34-49a5-b13d-499f67cbf0b7.jpeg",
    "type": "image/jpeg",
    "uri": "file:///data/user/0/host.exp.exponent/cache/ExperienceData/.../ImagePicker/5f9ed62a-6e34-49a5-b13d-499f67cbf0b7.jpeg",
},

Send a photo to my server and expected to be successful

0

There are 0 answers