Works with any backend npm install Zero dependencies

onFileAdded Callback

Fires when a file passes validation and is added to the queue.

(function() {
 var logEl = document.getElementById('log');
 function log(m) { var d = document.createElement('div'); d.className='pkg-log-entry'; d.textContent=m; logEl.appendChild(d); logEl.scrollTop=logEl.scrollHeight; }
 new MultipleUpload('#demo', {
 uploadUrl: '/api/upload',
 multiple: true,
 autoUpload: false,
 onFileAdded: function(task, uploader) {
 log('Added: ' + task.fileName + ' (' + MultipleUpload.formatSize(task.fileSize) + ') - Queue: ' + uploader.tasks.length);
 }
 });
})();

The first hook a file passes

onFileAdded fires as a file enters the queue, after it has passed validation and before it starts uploading. It receives the task and the uploader, and it is the right place to render your own queue row, attach metadata, or record what the user picked.

It is not a validation hook

By the time it fires the file has already been accepted, so it is too late to reject one here. Use allowedExtensions, the size and dimension limits, or onBeforeUpload for a check that has to be able to say no.