react-native-fs
react-native-fs copied to clipboard
Permission Denial : Reading {Uri} requires that you obtain access using ACTION_OPEN_DOCUMENT or related API's
Failing in the final catch block. Works with local paths sometimes, but not with google drive or some other phones
DocumentPicker.show({
filetype: [DocumentPickerUtil.pdf()],
}, (error, res) => {
var newP = RNFS.TemporaryDirectoryPath + "/" + res.fileName
var unc = decodeURIComponent(res.uri)
RNFS.copyFile(unc, newP).then((f) => {
let docHash = RNFS.hash(newP, 'sha256').then((hash) => this.send(res.fileName, hash)).catch(e => alert(e));
this.getData();
}
).catch(e => alert(e));
Same problem
I faced the same problem, try this, worked for me:
var unc = (Platform.OS == 'ios') ? decodeURIComponent(res.uri) : res.uri;
rn-fetch-blob works for me, ref to https://github.com/itinance/react-native-fs/issues/756#issuecomment-554937928