To upload multiple files, I am using JavaScript to loop through the files. To upload the files I am using the jQuery form plugin http://archive.plugins.jquery.com/project/form
Now, when the loop runs through, it runs to the end of the loop instantly, and uploads all files in one go.
Is there a way to get the loop to hold off during each upload?
This is an example of the loop im using (the actual code is quite large)
for(i=0;i<=num;i++)
{
if(go1){
<?php //if 1 upload only, hide add and upload button ?>
$('#ad,#ok').hide();
var z=i;
$('#up'+i).ajaxSubmit({
dataType:"json",
beforeSubmit:function(before){
$('#loadingsignup').show;
$("#resultsignup").empty().hide();
},
success:function(retour){
res=retour;
if(num<1){ <?php // only one upload, redirect if uploaded correct, reintroduce upload button if error ?>
if(res.ok=="ok"){
window.location.replace('<?php echo $config['baseurl']; ?>/player/'+res.aid);
}else{
$('#rs'+z).append('<div class="pasgood">'+res.err+'</div>').show();
$('#ad,#ok').show();
}
}
}
});
}
}
I really need the loop to move through the uploads one at a time.