Search code examples
cordovameteorngcordova

Download image from URL with parameters to device using cordova-plugin-file-transfer


I'm trying to download an image from a server using MeteorJS/ngCordova/cordova-plugin-file-transfer

My URL has additional parameters:

https://www.myserver.com/files/lkjsdlgjlsd/myImage.jpeg?store=originals

When calling fileTransfer.download(...) using this url I get the error code

1 = FileTransferError.FILE_NOT_FOUND_ERR

However if I only use

https://www.myserver.com/files/lkjsdlgjlsd/myImage.jpeg

without the additional parameter the download succeeded (but I don't receive the data I'm interested in).

Is there a way to download from such a url with parameters to a cordova-device using ngCordova/ionic or another library?


Solution

  • I figured out the issue: It was the permission to write on the filesystem. Thus, the FILE_NOT_FOUND_ERR corresponds to the file to write, and not the file to download (See body property in FileTransferError object).