Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
PhoneGap / Cordova File Download
var fileSystem;
var documentRoot;
function onAppReady() {
window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, gotFS, function() {});
function gotFS(fileSystem) {
fileSystem = fileSystem;
documentRoot = fileSystem.root.fullPath;
function downloadFile() {
var filePath = 'PATH TO YOUR FILE'; //For example:
var localFileName = 'YOUR FILE NAME'; //For example: bigmovie.mpg
var ft = new FileTransfer();
function(entry) {
alert('File Downloaded');
function(error) {
//Handle the error
document.addEventListener("deviceready", onDeviceReady, false);

usmart commented Oct 19, 2012

Do you know how I can get that to work for the inAppPurchaseManager. I have a github here with my example code on how I do it when unlocking products, but my main goal is to be able to download the magazine from my server then view it on my app. Any help you can give would be awesome!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment