React native web upload file with form data

Please provide the following:

  1. SDK Version: 37
  2. Platforms(Android/iOS/web/all): Web

Hi
I’m trying to upload a file in RN with expo.
It works well with Android but when I try it on the web but I get an Error.
My code looks like https://github.com/expo/examples/tree/master/with-formdata-image-upload in both client and server (server upload to memory instead of S3)

 const result = await ImagePicker.launchImageLibraryAsync({
        mediaTypes: ImagePicker.MediaTypeOptions.Images,
        allowsEditing: true,
        aspect: [1, 1],
        quality: 1,
      });

const {uri} = result
// in android uri is file://data/user/0/host.ep.....jpg
// in the web uri is data:image/png;base64,iS3ks...
async function uploadImageAsync(uri) {
const formData = new FormData();
  formData.append('photo', {
    uri,
    name: `photo.${fileType}`,
    type: `image/${fileType}`,
  });

  let options = {
    method: 'POST',
    body: formData,
    headers: isWeb ? null : {
      Accept: 'application/json',
      'Content-Type': 'multipart/form-data',
    },
  };

I remove the headers from web because I had issue with the boundary.
Now I have problem with the web in the backend - multer does not initialize the req.file
Does anyone succeed uploading file in Expo in React Native Web?

Hello, am having a similar issue. Trying to upload an audio file on react native web using expo, the base 64 uri does not work and causes my Audio.Sound().loadasync() to crash