Quantcast
Viewing all articles
Browse latest Browse all 13

How to download an array of files?

I have an array of files and I want to download them all. What is the best way to do that, because I think that the code bellow will not work, because it doesn't wait until each download is finished.

var c = Titanium.Network.createHTTPClient();
 
for(var i=0;i<array.length;i++){
    c.setTimeout(10000);
    c.onload = function(){
        var f = Titanium.Filesystem.getFile(Titanium.Filesystem.applicationDataDirectory, filename);
};
 
    // open the client
    c.open('GET', url);
 
    // send the data
    c.send();
}
I want to download one after the other because I have one Progressbar and I want to change the message for each file.

Viewing all articles
Browse latest Browse all 13

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>