Created
June 25, 2013 09:07
-
-
Save Drvanon/5857075 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function downloadFile() | |
{ | |
window.requestFileSystem( | |
LocalFileSystem.PERSISTENT, 0, | |
function onFileSystemSuccess(fileSystem) { | |
fileSystem.root.getFile( | |
"dummy.html", {create: true, exclusive: false}, | |
function gotFileEntry(fileEntry) { | |
var sPath = fileEntry.fullPath.replace("dummy.html",""); | |
var fileTransfer = new FileTransfer(); | |
fileEntry.remove(); | |
fileTransfer.download( | |
"http://www.w3.org/2011/web-apps-ws/papers/Nitobi.pdf", | |
sPath + "theFile.pdf", | |
function(theFile) { | |
console.log("download complete: " + theFile.toURI()); | |
showLink(theFile.toURI()); | |
}, | |
function(error) { | |
console.log("download error source " + error.source); | |
console.log("download error target " + error.target); | |
console.log("upload error code: " + error.code); | |
} | |
); | |
}, fail); | |
}, fail); | |
}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment