Converting image (iOS) URI from react-native-image-picker to path using rn-fetch-blob

872 Views Asked by At

I'm using react-native-image-picker to pick the images. After picking image, I want to upload these image to server using fetch, there I need an absolute file path. So, for converting URI to path I'm using rn-fetch-blob, but it is throwing errors as follow.

failed to stat path "file:///Users/banuharshavardhan/Library/Developer/CoreSimulator/Devices/407B8294-598D-41B3-84FC-E9217F8A434F/data/Containers/Data/Application/63B690A7-976E-4057-91CD-1314B3D3DDBC/tmp/521AC266-01E2-4B20-A8F6-4A3001B0D459.png" because it does not exist or it is not a folder

Can you explain that what I did wrong. I'm running this on iOS simulator.

I'm thinking that, the URI given by react-native-image-picker was a temporary location, that's why it doesn't exists. But don't know what exactly the problem is.

1

There are 1 best solutions below

0
On

you just need to remove the file:// part from the path