1

I have tried uploading images to node js server, It is working fine with expo-image-picker but it is not working in react-native-image-picker

by doing this I noticed that the URI between expo and react-native CLI is different

by using expo-image-picker the URI is

  "uri": "file:///data/user/0/host.exp.exponent/cache/ExperienceData/%2540satya89310%252Fembteen/ImagePicker/a05bf1a7-cef8-4cef-b73d-8fc330007927.jpg",

this is working fine and the image is uploading on node js server

but by react-native-image-picker the URI is

"uri": "content://com.embteen.provider/root/storage/emulated/0/Pictures/images/image-12b4f263-5747-4404-a41e-1acf8926ea24.jpg"

Which is not uploading the image.

What did I miss ?

rahul
  • 408
  • 6
  • 21
  • Please help me how to do that ? – rahul May 29 '20 at 05:13
  • The only thing I can tell you is that expo-image-picker works like a charm and react-native-image-picker is just bad I cant even get it running because it only throws errors. – yesIamFaded May 29 '20 at 06:52

1 Answers1

1

When you are using react-native-image-picker on android, you should use response.path instead response.uri to get the actual file path. check out docs

Don't forget to add file:/// to the beginning of response.path you get from android.

response.uri is not a persistent path and can't rely on it when uploading.

mcnk
  • 1,690
  • 3
  • 20
  • 29