1

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?

2
  • Use php microtime() function instead xD Commented Jan 26, 2016 at 14:49
  • @Hackerman Wish I could, but unfortunately I can't due to the restrictions of the naming conventions in place. Commented Jan 26, 2016 at 15:27

2 Answers 2

1

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..

Sign up to request clarification or add additional context in comments.

Comments

0

I couldn't find a way to do it within the script. So, instead, I put a 1 second sleep on my ajax script.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.