@mrcrix wrote:
I'm trying to save an image from an external url on the web to the local app using ionic 2 but I cannot get the job done, I've added already the plugin cordova-plugin-file and cordova-plugin-file-transfer but when I try the following code example I get the error "FileTransfer is not defined", It should be globally defined from the plugin correct?
I use typescript.Could someone explain me how to get the job done? Any help would be appreciated, thank you!
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("upload error code" + error.code);
},
false
}
);
Posts: 2
Participants: 2