Hi there,
I have a file_upload
field where users can upload multiple files. I also use your suggested jQuery binding events method to trigger various feedback to the user like this:
jQuery( function( $ ){
setTimeout( function() {
const myUploader = $( 'input.rwmb-file_upload.rwmb-media' ).data( 'uploader' );
myUploader.uploader.bind( 'FileUploaded', function( up, file, res ) {
// Do some stuff
} );
myUploader.uploader.bind('UploadProgress', function (up, file) {
// Do some stuff
} );
myUploader.uploader.bind('FilesAdded', function (up, file) {
// Do some stuff
} );
}, 1000 );
} );
All works fine!
However, this methodology fails when there are multiple file_upload
custom field instances on the same page. IE: I have one instance for just a featured image and another instance for an image gallery.
Q) How or what is considered the correct method to target multiple file_upload
instances on the same page via jQuery? The const myUploader = $( 'input.rwmb-file_upload.rwmb-media' ).data( 'uploader' );
only targets a single instance right?
I look forward to your response 🙂