Upload orders using Dropzone.js

I am using Dropzone.js and my PHP script to upload files to my server. I notice that they definitely don't load in the order in which I select them. For example, let's say that I have 1.jpg, 2.jpg, 3.jpg, 4.jpgand 5.jpg.

They load in the order in which the server receives them faster. Thus, it can be loaded as 4, 2, 5, 3, 1.

My PHP script also inserts the file into the database, so ordering is important. I could not find the configuration option for loading in order, but I think I can go through the queue and load them that way, and not let dropzone handle the queue.

+4
source share
1 answer

parallelUploads set to 1 should help, but it will slow down pretty much depending on how many files / file size will be downloaded.

To return to parallel downloads, but you have control over the order, you can pass the file ID back in response to your download URL, which can be read in the dropzone success event ...

dropzoneObject.on("success", function (file, response) {
    // Requires a hidden field named FileIDs to exist in your previewTemplate.
    $(file.previewElement)
        .find("input[name='FileIDs']")
        .val(response);
});

And after the download is completed (queuecomplete event), you can send back the file IDs in the order you want.

+2
source

All Articles