Reputation: 16716
I'm using blueimp's jquery-file-upload to upload mulitple photos
https://blueimp.github.io/jQuery-File-Upload/
I've created a multiple selection input box and setup the upload script:
<script>
$(function () {
$("#upload_files").fileupload({
autoUpload: true,
dataType: "json",
singleFileUploads: true,
sequentialUploads: false,
url: "/photos/my_upload_script",
add: function (e, data) {
data.submit();
},
progressall: function (e, data) {
var progress = parseInt(data.loaded / data.total * 100, 10);
$("#version_progress_bar .progress-bar").css("width",progress + "%");
},
done: function (e, data) {
if(data.result.status == "success"){
alert('well done');
}
else {
alert("it's gone pete tong!");
}
}
});
});
</script>
The problem I have, is my historic naming convention for uploaded photos. I'm restricted in that I must use PHP's time() function. This becomes a problem when more than one photo's upload is triggered within the same second.
So, is there a way I can get jquery-file-upload to upload each photo one-by-one but still allow multiple selections in hopes that this will prevent photos uploading within the same second?
Upvotes: 1
Views: 855
Reputation: 23
is there a way I can get jquery-file-upload to upload each photo one-by-one but still allow multiple selections
Yes. You already have the option in your code that decides this behavior:
sequentialUploads: false,
Change that to true and you upload sequentially, one after another..
Upvotes: 1
Reputation: 16716
I couldn't find a way to do it within the script. So, instead, I put a 1 second sleep on my ajax script.
Upvotes: 0