I am using a Cordova FileTransfer object to download a file from a URL to a device.
var fileTransfer = new FileTransfer(); var path = cordova.file.dataDirectory; fileTransfer.download( fileUrl, path + "/sample.pdf", function(theFile) { console.log("download complete: " + theFile.toURI()); alert("File downloaded to "+cordova.file.dataDirectory); }, function(error) { console.log(JSON.stringify(error)); } );
In this case, the file is uploaded to data/data/com.fileDemo/files/ (I'm not sure that the download is successful, because I cannot access this folder. Receiving a success message as download complete: file:///data/data/com.fileDemo/files/sample.pdf ). How can I use the same method to upload a file to the βDownloadsβ folder of an Android device?
source share