Send Formdata Using Dropzone.js On Sendingmultiple
The dropzone.js documentation/wiki doesn't say how to send form fields. I just read about the FormData object and it says how to populate the object with the form fields. The probl
Solution 1:
see comments...
myDropzone.on('sendingmultiple', function(data, xhr, formData) {
// this will get sent
formData.append('name', jQuery('#name').val());
// this won't -- we don't need this rn, we can just use jQuery
// var myForm = document.querySelector('form');
// you are overwriting your formdata here.. remove this
//formData = new FormData(myForm);
// instead, just append the form elements to the existing formData
$("form").find("input").each(function(){
formData.append($(this).attr("name"), $(this).val());
});
});
Solution 2:
init: function() {
this.on("sending", function(file, xhr, formData) {
//formData.append('task_name', jQuery('#task_name').val());
$("form").find("input").each(function(){
formData.append($(this).attr("name"), $(this).val());
});
});
}
Post a Comment for "Send Formdata Using Dropzone.js On Sendingmultiple"