Created
February 20, 2012 19:19
-
-
Save toddfreese/1870853 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| - (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