So I'm using Cordova with Windows Azure Storage and I'm using the plugins file-transfer and file from Cordova to download a file with public access from Azure. I get the error code 1 (FileTransferError.FILE_NOT_FOUND_ERR). I am pretty sure my URL is correct, so I was wondering if it was due to me not adding authentification to the headers... But since it's a public file, do I really need the authentification?
Here is my code for Cordova, if that may help:
var fileTransfer = new FileTransfer();
var uri = encodeURI("https://MY_ACCOUNT.blob.core.windows.net/MY_CONTAINER/test2.txt");
var fileURL = cordova.file.dataDirectory;
fileTransfer.download(
uri,
fileURL,
function(entry) {
alert('entry');
alert("download complete: " + entry.toURL());
},
function(error) {
alert("error code" + error.code);
},
false
);
For those who might get in the same problem as me, it was the fileURL path that was incomplete. At the end of the fileURL, you have add your file's name, so mine would be:
var fileURL = cordova.file.dataDirectory+"test2.txt";