I am trying to upload an image as binary. I used rn-fetch-blob library for this one. Because normal fetch gives network errors.
const path = file.path.replace('file://', '');
const uploadPath = RNFetchBlob.wrap(path);
RNFetchBlob.fetch(
'PUT',
SERVER_URL,
uploadPath,
)
.then(res => {
console.log('image uploaded res ---> ',res);
})
.catch(err => {
console.log(err);
});
it uploads an empty stream and the server stores a zero-byte size file. Any solution for this issue?
This is because it is not able to find the image file at the
path specified. Can you please try something like this and let me know ?Hope it helps