Skip to content

IOS file downloaded not able to be located on device #897

@Znow

Description

@Znow

Hi there

Using a standard implementation to download files and save them locally on the device.
When they are downloaded, I am not able to locate them on the device with for example "File Explorer" app, tried on emulator and physical iPad.

const urlExtensions = this.getUrlExtension(attachment.url);
      const localFile = `${RNFS.LibraryDirectoryPath}/${attachment.title}.${urlExtensions}`;
  
      const options = {
        fromUrl: attachment.url,
        toFile: localFile,
        fileCache: true
      };

      if (await RNFS.exists(localFile)) {
        FileViewer.open(localFile);
      } else {
        await RNFS.downloadFile(options).promise
        .then(() => { 
          FileViewer.open(localFile);
        })
        .then((res) => {
          // success
          // console.log("success");
        })
        .catch(error => {
          // error
          console.log("Attachment open error: ", error);
        });
      }

Also tried to use "DocumentDirectoryPath", same issue.

Thanks in advance

Regards

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions