Open pdkn opened 6 years ago
same issues . And here my code
RNFetchBlob.fetch(
'POST',
url',
{
headers: {
Authorization: this.props.token
},
Accept: 'application/json',
// 'Content-Type': 'multipart/form-data',
'Content-Type': 'multipart/form-data'
},
[
{
name: 'photo',
// filename: response.fileName || 'CoverIMG.JPG',
filename: 'IMG_0003.JPG',
type: 'image/jpg',
data: RNFetchBlob.wrap(url.replace('file://', ''))
}
]
)
+1
+1
same issues . And here my code
RNFetchBlob.fetch( 'POST', url', { headers: { Authorization: this.props.token }, Accept: 'application/json', // 'Content-Type': 'multipart/form-data', 'Content-Type': 'multipart/form-data' }, [ { name: 'photo', // filename: response.fileName || 'CoverIMG.JPG', filename: 'IMG_0003.JPG', type: 'image/jpg', data: RNFetchBlob.wrap(url.replace('file://', '')) } ] )
change 'Content-Type': 'multipart/form-data'
to 'Content-Type': 'application/json'
and
JSON.stringify([
{
name: 'photo',
// filename: response.fileName || 'CoverIMG.JPG',
filename: 'IMG_0003.JPG',
type: 'image/jpg',
data: RNFetchBlob.wrap(url.replace('file://', ''))
}
])
In order to support iCloud assets we're using https://github.com/olofd/react-native-photos-framework. This returns URI's that are prefixed with "photos://" When trying to wrap the URI and send for upload it responds "Error: RNFetchBlob.fetchBlobForm failed to create request body"
example code
Any thoughts? Many thanks