Reputation: 1
how to get react-native-document-picker uri to get rael path
react-native-document-picker res is=-- size: 76711 name: "IMG-20200420-WA0000.jpg" type: "image/jpeg" uri: "content://com.android.providers.media.documents/document/image%3A551098"
but i want uri to path like path: "/storage/emulated/0/DCIM/Camera/IMG20200419175011.jpg or can upload on server
Upvotes: 0
Views: 2539
Reputation: 1568
react-native-real-path will be helpful in this.
RNGRP.getRealPathFromURI(image.path)
.then(filePath => {
let data = convertToFile(
filePath.substring(filePath.lastIndexOf("/") + 1),
image.path
);
this.isImageUriOrNot = false
this.setState({
imageData: data,
imageUri: { uri: image.path },
loadCameraScreen: false,
});
})
Upvotes: 0