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 ?

2
  • Please help me how to do that ? Commented May 29, 2020 at 5: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. Commented May 29, 2020 at 6:52

1 Answer 1

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.