You can’t hook it directly as wp.Uploader doesn’t expose it but you can use its init() to hook its internal pluploader instance:
add_action( 'admin_print_footer_scripts', function () {
?>
<script type="text/javascript">
(function ($) {
if (typeof wp.Uploader === 'function') {
$.extend( wp.Uploader.prototype, {
init : function() { // plupload 'PostInit'
this.uploader.bind('BeforeUpload', function(file) {
console.log('BeforeUpload file=%o', file);
});
},
success : function( file_attachment ) { // plupload 'FileUploaded'
console.log( file_attachment );
}
});
}
})(jQuery);
</script>
<?php
}, 100 );
Related Posts:
- Trigger refresh for new media manager in 3.5
- Refresh wp.media after ajax call
- How to make Plupload zones that will survive changes in core?
- Plupload Intergration in a meta-box?
- Display attachments by ID in a wp.media frame
- Custom “Uploads” Dir: “Edit Image” in Media Library broken
- retrieve custom image sizes from media uploader javascript object
- Add inline uploader to plugin option page
- How to restrict images in v3.5 Media Library modal to only those from a specific post id?
- WP 3.5 media manager – how to create a working gallery frame
- Is it possible to trigger some JavaScript when Media Popup is opened?
- Disable media library tab for non admins in uploader screen
- Trigger JS when featured image upload window is opened in admin
- Modify the array of selected images in media modal
- How to get the image url in the input box from media library?
- WP3.5 Media Uploader – how to make it accept multiple images?
- Trying to add filename over image in Media Browser
- Add/change multipart_params parameter when uploading post image
- Filter medias from the Media Uploader (wp.media) modal with a post meta
- post_id missing from the wp-admin file upload request
- How to change the image size in new Media Uploader (ie use medium vs thumbnail)
- Restrict file types in the uploader of a wp.media frame
- Close the media-upload thickbox right after upload is finished?
- wp.media add context
- wp_enqueue_media() Will not load JS on the theme
- Switch between tabs on “Insert Media” dialog
- Adding Media Upload to Custom Options Panel breaks “Insert into Post”
- Calling WP Gallery Uploader/Selector From Metabox
- How to disable plupload completely from latest wordpress 3.6 and make browser upload default
- Use custom image size in admin panel
- Display attachments by the ID of the post being edited in the wp.media frame (frontend)
- async_upload.php 500 Error when Uploading larger files with slow internet connection and latency
- WordPress 4.9.8 Trying to add filename over image in Media Browser
- How to submit data between wp_iframe and backbone.js in media upload
- “send_to_editor” function returning pdf file name
- How to get the return value of wp.media({ frame: ‘post’ }) in all cases?
- WordPress Media frame pre load images from ids
- Set post_parent value for the images uploaded by Add Media button into post
- Capability to prevent upload of files
- admin notice on Insert Media popup screen
- Open Media Uploader Link in single post or page
- How to get file object from file_attachment?
- How to locate the js code and php code for certain function?
- Make inline uploader (plupload) on options page upload to a specific folder
- WordPress Media manager select file button, how to prevent hiding?
- Insert into post or
- I want to customize wp.media (the wordpress admin uploader) in order to change the file name but only in video custom post type
- Simplifying ‘Add Media’ Modal in front-end Content Editor
- WordPress Permissions Issue for Media Library / uploading
- wp_upload_dir how to get just the directory name .
- Can’t upload media, permissions are correct
- How Can I Organize the Uploads Folder by Slug (or ID, or FileType, or Author)?
- Using same directory for storing all uploaded images on a WordPress network
- Contact Form 7 – process form using a PHP script, instead of mailing [closed]
- Is wp_read_audio_metadata() function deprecated?
- WordPress REST Upload Media
- How to validate the file name of the Media File Uploads?
- Restrict file uploads by extension?
- Add a file type
- WordPress upload file – get path to WordPress installation
- Issue on Running Image upload on WP Metabox Custom Image Loader
- Check if image exists before uploading with media_sideload_image()
- Plugin to Import Dropbox Files into Media Folder from the Cloud [closed]
- Disable gallery in 3.5 media iframe
- Refreshing collections in the admin media manager
- Resize the WP media Uploader iFrame
- Uploading dwg files to wordpress
- Images not being generated at correct size
- Remove attachment fields from custom media uploader
- How to use MediaUpload outside of editor
- update_options and unique filenames
- Is It Possible to Upload Certain Attachment Files To A Remote Server
- After moving from complete AWS setup to a standalone WordPress Server, Media/Image Files are Broken
- Upload Button in meta box not opening library
- Local WordPress install plugin wont upload image
- Disable new WP3.5 Media Picker
- User permissions to upload images
- Why is WordPress’ file upload limit so low? Is changing it harmful?
- Moving Existing images from custom directory to WP’s upload directory
- Website does not reflect changes on live after uploading files via FTP
- How to change the text of the “You are about to permanently delete these items…” alert message when deleting media from the media library?
- Programmatically Upload File to WordPress Using an API [closed]
- Uploading flash flipbook to mu wordpress site
- Uploaded images result in a file url with full path on disk appended
- Change Link to Upload folder
- Which wordpress action fires after crunching
- Workaround to upload AVIF files
- SVG not displaying in Media Tab in Backend
- Images not displaying on site or media library
- Changing WordPress media location and upload path to sub-domain not working
- Picture upload issue – broken thumbnail
- Media not displaying other users uploads – WordPress 4.9.2
- Unable to upload anything to WordPress site
- Uploads from site on Server A uploaded on Server B (Like sort of CDN)
- Creating an Uploads folder with post ID
- Limit WP Uploader to certain file types only in pages
- Attachment Metadata not updated while uploading audio files
- http upload error as a subscribed user
- Limit max upload file size in front end submmission form
- Cannot upload CSV via REST API: ‘Sorry, not allowed to upload this file type.’ but it does work through the WordPress Dashboard