Sortable Queue
Sort tasks by priority, size, or name. Use sortTasks() for custom ordering.
(function() {
var uploader = new MultipleUpload('#demo', {
uploadUrl: '/api/upload',
multiple: true,
autoUpload: false,
sortable: true
});
document.getElementById('sort-select').addEventListener('change', function() {
var v = this.value;
if (!v) return;
uploader.setOptions({ sortBy: v });
uploader.sortTasks(function(a, b) {
if (v === 'size') return a.fileSize - b.fileSize;
if (v === 'name') return a.fileName.localeCompare(b.fileName);
return b.priority - a.priority;
});
});
})();
Reordering before upload
sortable lets the user drag queue rows into a different order, which also implies enableQueueReorder. With autoUpload off, that order is the order files will be sent in.
When order carries meaning
Pages of a document, chapters, images in a gallery whose sequence is the content: in all of them the selection order is an accident of how the user browsed their disk, and being able to fix it before uploading is much easier than reordering afterwards in a second interface.
Drag-to-reorder needs a keyboard equivalent to be usable by everyone — move-up and move-down controls on each row are the simplest answer.