Uploaded image for project: 'Apache Cordova'
  1. Apache Cordova
  2. CB-6720

Cordova File-Transfer download fails on iOS

    XMLWordPrintableJSON

Details

    Description

      File-Transfer download function exits with

      "TypeError: 'null' is not an object (evaluating 'result.lengthComputable')"

      Plugin version is 0.4.3, i tried 0.4.2 but the error is still the same. Please refer to this post:

      http://stackoverflow.com/questions/23317010/cordova-file-transfer-download-result-null-error

      Same exact code works fine on Android 4.0.2 .

      EDIT:
      Sample code used for testing:

      function win(entry){
          console.log("OK!");
      }
      
      function fail(error){
          console.log("ERROR!");
          console.log(error.code);
      }
      
      
      var url = "http://upload.wikimedia.org/wikipedia/commons/5/5b/Ultraviolet_image_of_the_Cygnus_Loop_Nebula_crop.jpg";
      
      var filename = "filename.jpg";
      
      
      var uri = encodeURI(url);
      window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, function(fileSystem) {
             fileSystem.root.getFile(filename, {create: true, exclusive: false}, function(fileEntry) {
                 var localPath = fileEntry.toURL();
                 var ft = new FileTransfer();
                 ft.download(uri,localPath,win,fail,false);
      
             },function(error){console.log("errore 1: " + error.code);});
          },function(error){console.log("errore 2: " + error.code);});
      
      

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              ZcsMob Zcs Mobile
              Votes:
              4 Vote for this issue
              Watchers:
              9 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: