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
- remove links in pop-up media gallery
- WordPress Permissions Issue for Media Library / uploading
- Moving wp-content folder to public_html
- wp.media – drag&drop overlay stuck
- problem when uploading file by metaboxes
- Media not displaying other users uploads – WordPress 4.9.2
- Add file upload with validation to custom form
- An error occurred in the upload. Please try again later
- Unable to upload anything to WordPress site
- Using WordPress’s add_cap method to Allow Contributors to Upload Media is not Working
- Access featured image URL based on media ID?
- Set default “Link CSS Class” in add media admin editor
- media_sideload_image results in http error (500)
- Using Gravity Forms to upload media into library, then attach to post
- Uploads from site on Server A uploaded on Server B (Like sort of CDN)
- Media import failed in the WordPress importer
- Set attachment category from file name on upload
- HTTP Error WordPress on IIS uploading image
- I want url from a file in media using title file
- Async.upload.php (Error Message: Failed to load response data)
- Import all media referenced in posts
- How to change default upload dir?
- What folder to place Large Video files?
- Creating an .ics calendar subscription service with wordpress
- How could you allow users to upload a video in within their profile and display it on a wordpress site?
- Creating an Uploads folder with post ID
- Changed media upload path for plugin, but generates error & shows wrong url
- WP_Custom_Media_Control | Give ID to media file
- Some images not appearing after switching from AWS S3 back to local
- How to destroy or dispose wordpress uploder/manager?
- 45mb File Exceeds the Maximum Execution Time
- How use custom upload directories in filesystem and url based on media type or category
- How to share media between independent blogs?
- I migrated WPMU site: Unable to create directory uploads/… Desperate for help!
- Uploading a file results in attachment post, but file is missing
- wp_enqueue_media(); in multiple widgets
- “Could not write file” error in wp_upload_bits function
- How can i link my featured image to be clicked and the file will be downloaded
- media_handle_upload on mix form fields (not required file input)
- Site Icon upload and display in a theme
- Include file upload button inside post and process file
- WP Add Media Button – Can I set the default size to Original/Full Size
- WordPress Upload Speed
- Video limit about wordpress
- Nginx – WordPress Upload only images rule
- Images not aligning correctly
- Redimension thumbnail crop without creating new images
- Why I am not able to upload media files?
- _d_improd_ directory in uploads breaking site images
- Check if author or uploader id of the attachment(uploaded) image is match?
- WP Capabilities to Add Media, Use Media, But Not Edit Them
- How to get images to show in Media when saved Via PHP