react-native-fs icon indicating copy to clipboard operation
react-native-fs copied to clipboard

Permission Denial : Reading {Uri} requires that you obtain access using ACTION_OPEN_DOCUMENT or related API's

Open ghost opened this issue 6 years ago • 3 comments

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));

ghost avatar May 20 '19 22:05 ghost

Same problem

LucasMonteiro1 avatar Jun 05 '19 14:06 LucasMonteiro1

I faced the same problem, try this, worked for me:

 var unc = (Platform.OS == 'ios') ? decodeURIComponent(res.uri) : res.uri;

humanolaranja avatar Aug 29 '19 17:08 humanolaranja

rn-fetch-blob works for me, ref to https://github.com/itinance/react-native-fs/issues/756#issuecomment-554937928

flyskywhy avatar Mar 22 '22 06:03 flyskywhy