cordova 2.0.0 download file Android

Posted by N0rA on Stack Overflow See other posts from Stack Overflow or by N0rA
Published on 2012-09-30T15:34:31Z Indexed on 2012/09/30 15:37 UTC
Read the original article Hit count: 533

I tried to use cordova 2.0.0 API FileTransfer().download() and i got 2 consecutive errors 1) download error source file 2) download error target file

here is my code...

 function downloadMaterial() {

    var fileTransfer = new FileTransfer();
    var serverURL = 'http://img.youm7.com/images/NewsPics/large/S2200921125437.jpg';  

    var uri = encodeURI(serverURL);
    var filePath = persistent_root.fullPath+"/" + fileName;
    //filePath = file:///data/data/com.example.studyapp/S2200921125437.jpg

    var onSuccess = function (entry) {
        console.log("download complete: " + entry.fullPath);
    };
    var onError = function (error) {
        console.log("download error source " + error.source);
        console.log("download error target " + error.target);
        console.log("upload error code " + error.code);
    };
    fileTransfer.download(uri, filePath , onSuccess, onError);
}

Do you have any idea what should I do? Thanks in advance ...

© Stack Overflow or respective owner

Related posts about android

Related posts about file-download