0

I'm trying to use , but it always returns me with this response:

PS: The url欧洲杯买球 is a direct link to the download

I really have no idea of whats wrong in this code

欧洲杯买球FileTransferError { body:null, code:null, exception:null, http_status:null, source:null, target:null }

My code:

    const storageDirectory = '';
    this.platform.ready().then(() => {
      storageDirectory = cordova.file.externalRootDirectory;

      let url = this.apiURL + itemId
      const fileTransfer: FileTransferObject = this.transfer.create(); 

      fileTransfer.download(url, storageDirectory + "item" + itemId+ ".xml")
        .then(response => { 
          const alertSuccess = this.alertCtrl.create({
            title: `Successfully downloaded!`,
            subTitle: `The file is in: \n: ${response.toURL()}`,
            buttons: ['Ok']
          }); 
          alertSuccess.present();
        })
        .catch(err => { 
          const alert = this.alertCtrl.create({
            title: 'Error!',
            subTitle: 'Try again!',
            buttons: [{
              text: 'OK',
              handler: () => {
                this.util.getPermission();
              }
            }]
          });
 alert.present();         
 });
 })
}


  • it is error in the plugin version, I was facing the same problem previously with the same plugin but now it is resolved... – Sayed Mohd Ali 2 days ago
  • @SayedMohdAli Please, be more specific. Which version of the plugin did you used? And how you did it? Make an answer with it, please. – MattDAVM 2 days ago
  • you need to remove file transfer plugin and also uninstall node package of file transfer plugin then reinstall it. according to your ionic version. In my case, I was using ionic 3 – Sayed Mohd Ali 2 days ago
  • you can use this tutorial, it helped me out. – Sayed Mohd Ali 2 days ago

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.