1

I am using react-native-fetch-blob to download excel file and these files are stored inside app/documents folder which I am not able to open in iphone and I don't know the absolute path of the iphone's document folder to save the file there.

here is my code:

downloadFile(){
    const dirs = RNFetchBlob.fs.dirs;
    let context = this,
        userBarRelationId = context.state.userBarId;
    RNFetchBlob
  .config({
    fileCache : true,
    path : dirs.DocumentDir + '/excel.xlsx'
  })
  .fetch('GET', 'http://localhost:5000/getExcel/'+userBarRelationId, {
  })
  .then((res) => {
    console.log('The file saved to ', res.path(), res.data)
  })
  }
Ankush Rishi
  • 2,861
  • 8
  • 27
  • 59

1 Answers1

-1

Wait, you're asking to save the data in a Documents folder other than the one your sandboxed application has access to?

This is not possible by iOS design. See also here. Not even a minute of google searching reveals you that, not to mention that it is basically a core principle.

If I didn't understand you I apologize, but then I have no clue what you want to know. If you're asking for how to save the file to the user's iCloud Drive (which kind of has a Documents folder, too), you'll have to invest some more work. I've never done it myself, but a good starting point is this.

Community
  • 1
  • 1
Gero
  • 4,394
  • 20
  • 36