1 Reply Latest reply on Aug 26, 2017 6:38 AM by kerrishotts

    how to download a 10mb file with fileTransfer or any other method??

    dt65647195

      -iPad/Android -

      I cannot use local storage or sql as the file is 10mb.

       

      I need to be able to download .json , .jpg and .png files to my applications folder not the sd card.

       

      Looking through the documentation I have tried the fileTransfer download example also but get an error message of "1".

      I suspect it has something to do with the filePath not being correct.

       

      PhoneGap API Documentation

       

       

      var filePath="/";
      var fileTransfer = new
      FileTransfer();
      var uri = encodeURI("http://www.mocky.io/v2/59a022952c00008d0e51d6a6"); // This is a tiny json file just as an example

      fileTransfer.download(
           uri,
           filePath,
           function(entry) {
               console.log("download complete: " + entry.fullPath);
           },
           function(error) {
               console.log("download error source " + error.source);
               console.log("download error target " + error.target);
               console.log("upload error code" + error.code);
           }
      );

       

       

      I have read all the links in the forum relating to fileTransfer:

      https://forums.adobe.com/search.jspa?facet=content&q=filetransfer&sort=relevanceDesc&place =%2Fplaces%2F4970418

        • 1. Re: how to download a 10mb file with fileTransfer or any other method??
          kerrishotts Adobe Employee

          You're trying to download to the root directory of your device ("/"), which is outside your app's sandbox and will be guaranteed to fail.

           

          You might try downloading to "cdvfile://localhost/persistent/somefile.json" and see if that works -- this should download the file to your application's sandbox. (Note: be careful where you store stuff on iOS, since Apple is twitchy about that. If the data is something that can always be redownloaded, store to a temporary location instead of a persistent location. cdvfile://localhost/temporary/... should work)