0

I'm trying to replicate this Postman Request on React Native. In this case, I'm taking two pictures with launchCamera and adding them to the DataForm, but it's not arriving succesfully on the backend. This is the Postman Request I need to replicate Not sure about it, but the problem seems to be happening on the second file

    form1.append("file", {
     name: response.assets[0].fileName, // Whatever your filename is
      uri: response.assets[0].uri, //  file:///data/user/0/com.cookingrn/cache/rn_image_picker_lib_temp_5f6898ee-a8d4-48c9-b265-142efb11ec3f.jpg
      type: response.assets[0].type, // video/mp4 for videos..or image/png etc...
    }); 


    form1.append("file1", { //This is the other function where I take the second picture
      name: response.assets[0].fileName, // Whatever your filename is
      uri: response.assets[0].uri, //  file:///data/user/0/com.cookingrn/cache/rn_image_picker_lib_temp_5f6898ee-a8d4-48c9-b265-142efb11ec3f.jpg
      type: response.assets[0].type, // video/mp4 for videos..or image/png etc...
    }); 


  return fetch('https://seahorse-app-vm8c4.ondigitalocean.app/xxxxxx', {
  method: 'POST',
  headers: {
    'Accept': '*/*',
    'Content-Type': 'multipart/form-data;',
  },
  body: form1
Federico
  • 1
  • 1

0 Answers0