LoginSignup
0
0

More than 5 years have passed since last update.

cloudinary multiple fileupload field

Last updated at Posted at 2015-02-08

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);
    }
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0