Send File issue

I’m bit confused with below code:

fetch(url)
.then(res => res.blob())
.then(blob => {

I have used below code for get blob:

RNFetchBlob.fs
		.readFile(source.uri, 'base64')
		.then((data) => {
			return Blob.build(data, { type: `${mime};BASE64` });
		})
		.then((blob) => {
			

			callMEhere(blob);

			return null;
		})
		.catch((error) => {
			//reject(error);
		});

After calling api getting error:
[TypeError: Network request failed]

Hi @walter.rodriguez
Can you please help me?

Can you please help me? Any feedback here?

I’m sorry I’m not familiar with RNFetchBlob but you need to verify that a correct Blob object is correct:

RNFetchBlob.fs
  .readFile(source.uri, 'base64')
  .then((data) => {
    return Blob.build(data, { type: `${mime};BASE64` });
  })
  .then((blob) => {
    // Here you need to verify the blob object to be valid
  })
  .catch((error) => {
    ...
  });

Here I have two blob:

{“listeners”:{},“isRNFetchBlobPolyfill”:true,“multipartBoundary”:null,"_ref":“content://media/external/images/media/531”,"_blobCreated":true,"_closed":false,“cacheName”:“blob-5b6uy580rpwxboj1ngilph”,“type”:“image/jpg;”,"_isReference":true,“size”:1757}

{“listeners”:{},“isRNFetchBlobPolyfill”:true,“multipartBoundary”:null,"_ref":"/data/user/0/com.subify.clubmember/files/RNFetchBlob-blobs/blob-iksbnoah4ccedxfbks5hnq","_blobCreated":true,"_closed":false,“cacheName”:“blob-iksbnoah4ccedxfbks5hnq”,“type”:“application/octet-stream”,“size”:1757}

Which one is valid?

I have another code and it’s return blob like below:

uri="content://media/external/images/media/531"
const response = await fetch(uri);
const blob = await response.blob();

blob:
{"_data":{“lastModified”:0,“name”:“IMG_1581070571244.jpg”,“size”:1757,“offset”:0,“type”:“image/jpeg”,“blobId”:“ef441b35-702a-4f45-8ba9-d2ea7b1d56a4”,"__collector":{}}}

I’m getting below error:
[TypeError: Network request failed]

It’s working fine with postman.

I am facing the exact problem. Anyone found a way to send file messages images/videos.