I\'m using a great plugin - dropzone.js (dropzonejs.com) to make my site a little more fancy when registering a new user.
Basically, the user fills out a form, drops a c
If you use the latest Dropzone version, the parameter enqueueForUpload
has been removed, in favour of autoProcessQueue
which makes the whole queuing easier.
So, just call myDropzone.processQueue()
as soon as you want all files to be uploaded.
To add additional parameters to the XHR
you can simply register to the sending
event, which gets the xhr
object as second and formData
as third parameter, and add the data yourself. Something like this:
myDropzone.on("sending", function(file, xhr, formData) {
// add headers with xhr.setRequestHeader() or
// form data with formData.append(name, value);
});
I used enyo answer, but i used many dropzones with data-id attribute in my page so I used:
$('div.dropzone').dropzone({
url: 'img.php'
});
var sendingHandler = function(file, xhr, formData) {
formData.append('id', $(this.element).data('id'));
};
$('div.dropzone').each(function() {
Dropzone.forElement(this).on('sending', sendingHandler);
});