Skip to content

Instantly share code, notes, and snippets.

@toddfreese
Created February 20, 2012 19:19
Show Gist options
  • Select an option

  • Save toddfreese/1870853 to your computer and use it in GitHub Desktop.

Select an option

Save toddfreese/1870853 to your computer and use it in GitHub Desktop.
- (void)downloadFileWithPath:(CPArray)fileURLs
{
// This method is called to start downloading a file.
// It gets called from the return responce of the getDownloadURL method.
//CPLog(@"downloadFileWithPath called with URL=%@", fileURL);
var x;
for(x=0; x<[fileURLs count]; x++) {
// Open off-screen window to start download. Window will automatically close and should be hidden all the time.
var downloadURL = function downloadURL(url) {
var iframe = document.createElement("iframe");
iframe.style.position = "absolute";
iframe.style.top = "-100px";
iframe.style.left = "-100px";
iframe.style.height = "0px";
iframe.style.width = "0px";
iframe.src = url;
document.body.appendChild(iframe);
// remove after 1 minute
window.setTimeout(function() {
document.body.removeChild(iframe);
}, 60*2000);
}
// Start the download.
downloadURL([fileURLs objectAtIndex:x]);
//CPLog([fileURLs objectAtIndex:x]);
}
[self closeProgressWindow];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment