Concurrent Queue
Upload up to 3 files simultaneously with concurrency: 3. Remaining files wait in the queue until a slot becomes available.
Active: 0 |
Pending: 0 |
Done: 0
var uploader = new MultipleUpload(document.getElementById('demo-concurrent-queue'), {
uploadUrl: '/api/upload',
multiple: true,
concurrency: 3,
onTaskStart: function() { updateCounts(); },
onTaskComplete: function() { updateCounts(); },
onTaskProgress: function() { updateCounts(); }
});
function updateCounts() {
var tasks = uploader.tasks;
var active = tasks.filter(function(t) { return t.status === 'uploading'; }).length;
var pending = tasks.filter(function(t) { return t.status === 'pending'; }).length;
var done = tasks.filter(function(t) { return t.status === 'completed'; }).length;
document.getElementById('cc-active').textContent = active;
document.getElementById('cc-pending').textContent = pending;
document.getElementById('cc-done').textContent = done;
}
Several files at once
concurrency defaults to 1. Raising it overlaps transfers so a batch of small files finishes noticeably sooner, because each spends less time waiting for its turn rather than transferring.
Watch the queue, not just the total
With several in flight the per-file bars all advance slowly and finish together, which reads as slower even when the batch completes faster. If the user is waiting on one particular file, sequential order or explicit priority serves them better than raw throughput does.