Answer the question
In order to leave comments, you need to log in
How to implement file download to phone in Apache Cordova?
Hello,
How can I download a picture or file (pdf, excel) to my phone?
Explain on your fingers please
Answer the question
In order to leave comments, you need to log in
https://cordova.apache.org/docs/en/6.x/reference/c...
var fileTransfer = new FileTransfer();
var uri = encodeURI("http://some.server.com/download.php");
fileTransfer.download(
uri,
fileURL,
function(entry) {
console.log("download complete: " + entry.toURL()); //Далее делаем со скаченным файлом что хотим
},
function(error) {
console.log("download error source " + error.source);
console.log("download error target " + error.target);
console.log("download error code" + error.code);
},
false,
{
headers: {
"Authorization": "Basic dGVzdHVzZXJuYW1lOnRlc3RwYXNzd29yZA=="
}
}
);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question