Network Request failed when I try to upload an image on Android


#1

Hi when I try to upload an image using android to my backend web server I get a network request failed.

I don’t get this error when I use my local IP address

Find my ode below:

fetch('http://mywebserver.com', {
        method: 'POST',
        headers: {
          Accept: 'application/json',
          'Content-type': 'multipart/form-data'
        },
        body: formData
      })

#2

You probably have a problem on your backend webserver if its working against your local IP address.

Or, possibly, you have a problem with the network connection on your Android device.


#3

I can upload images on IOS. Using the same code.

All my other calls to the backend web server works.

I only get an issue when I try to upload an image on android.

When I try to upload the same form without the image. It works.


#4

Can you post a snack (https://snack.expo.io) showing the problem? Hard to guess too much from what you’ve put here


closed #5

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.