react-native-fetch-blob icon indicating copy to clipboard operation
react-native-fetch-blob copied to clipboard

curl -F equivalent with RNFetchBlob

Open dahudson88 opened this issue 7 years ago • 1 comments

I am having some issues translating ‘-F’ in curl to something in react-native-fetch-blob when doing an upload. The API does not call for additional headers as shown in the example but rather a file and information about that file. Is there a way to translate this curl command into something that RNFetchBlob can process?

Curl Command:

curl -X POST https://something./api/uploadFile/ 
  -F file[][email protected] \
  -F name[]=tester \

RNFetchBlob Command:

RNFetchBlob.fetch('POST',https://something./api/uploadFile/, {
        Authorization : 'Basic 1234567NO',
        'Content-Type' : 'application/octet-stream'
      },imageData).then((resp) => {
     }).catch((err) => {}

React-Native version: 0.50.3 RNFetchBlob version:0.10.8

dahudson88 avatar Feb 07 '18 23:02 dahudson88

I can't figure this out either. I'm trying upload picture to strapi from ios. Used a bunch of ways but none of them worked. However with curl works.

jrodriguesimg avatar Aug 27 '18 18:08 jrodriguesimg