react-native-fetch-blob
react-native-fetch-blob copied to clipboard
JSON with multipart/form-data (upload image along with json payload)
I am trying to upload multipart/form-data but with JSON. I am trying this:
RNFetchBlob.fetch(
'PUT',
`${fetchApi.DOMAIN}/api/user`,
{
Accept: 'application/json',
Authorization: `Bearer ${fetchApi.TOKEN}`,
'Content-Type': 'multipart/form-data'
},
[
{ name:'avatar', filename:fileName, type:mimeType, data:RNFetchBlob.wrap(filePath) },
{ data: JSON.stringify(payload} }
]
)
Please notice the { data: JSON.stringify(payload} }
, I omitted the name
key. My backend is seeing this as empty. May you please advise?
@Noitidart do you see that on android?
@Kane-Sendgrid yes on android.