Default cloudinary js will trigger upload event on every file upload fields (selected with "input.cloudinary-fileupload[type=file]"
). To solve this, we just need to add each
and dropzone
option.
change:
jquery.cloudinary.js
$("input.cloudinary-fileupload[type=file]").cloudinary_fileupload();
to
jquery.cloudinary.js
$("input.cloudinary-fileupload[type=file]").each(function() {
$(this).cloudinary_fileupload();
})
and in the cloudinary_fileupload function, add dropZone
option. From:
jquery.cloudinary.js
if (initializing) {
options = $.extend({
maxFileSize: 20000000,
dataType: 'json',
headers: {"X-Requested-With": "XMLHttpRequest"},
}, options);
}
to
jquery.cloudinary.js
if (initializing) {
options = $.extend({
maxFileSize: 20000000,
dataType: 'json',
headers: {"X-Requested-With": "XMLHttpRequest"},
dropZone: this // <-- this
}, options);
}