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
- How to add a custom field to the media screen (image/gallery)?
- Large Uploads in WordPress
- can not upload file .vtt on wordpress 5.0.1
- How to prevent upload of a multiple sizes of images
- Convert uploaded PNG to JPEG automatically
- How to check if an image attachment exists before uploading
- Incremental number handling on duplicate file names
- wp_temp_dir does not change the /tmp temporary default directory
- How to upload all media to one folder, with no year/month subfolders
- Any way to define WP_UPLOADS_URL (like WP_CONTENT_URL)?
- upload files dynamically to user folders
- How to delete uploads not in media library?
- How to decrease the file size upload limit?
- Site icons with alpha channel for self-hosted WordPress blog network
- How can I allow upload of ttf or otf font files when hooking `upload_mimes` doesn’t work
- I made a website using WordPress, but the server is ColdFusion, how can I make it work?
- Using subdomain to upload media/images etc on 2 different blogs
- Can I upload a file to the site so that it is not accessible via an HTML page?
- why am i getting the ‘fatal error’ msg when uploading photos within specified MB?
- Media library only shows for admin. Doesn’t show editor or below [closed]
- Custom media uploader not showing library
- Symbolic link for uploads in wordpress
- Process uploads with phpThumb before generating thumbnails
- Resize existing library images
- WP 4.3.1 new install on localhost missing php.ini [closed]
- When does WP resize an image file
- Upload Custom Mime Types in WordPress (SVG, WebP)
- How to disable drag-and-drop upload function in Media Library?
- upload_max_size doesn’t change
- Upload and attach to a post multiple image files [closed]
- Batch upload to create posts each with one image, headline, and body text
- Control resizing of uploaded images
- How to add an upload image button (just like the one in the Custom Header) in the Theme Options I just created?
- protect files from downloading on other than my site
- How to add CSV upload functionality on the edit page of a Custom Post Type
- WordPress changing media file name upon upload
- How to remove media by filename?
- Restrict Users to Only Edit Media Owned by Users in Their Role
- media_handle_upload() returns Specified file failed upload test
- How to upload a file and have it available on the post for download?
- WP media upload issues
- Add file upload with validation to custom form
- How can i link my featured image to be clicked and the file will be downloaded
- Uploaded image doesn’t show up in media library
- Using media-upload.php – requires user to have edit_posts capability?
- WordPress problem uploading new media : File is empty. Please upload something more substantial
- limit the access to uploaded files
- How to force attachment size for every post
- Is it possible to upload multiple images via Media Library tab in Thickbox I’ve created?
- How to upload an image using media uploader and return the image link to javascript?
- Link or button to open the media manager from frontend
- Attach unzipped files to wordpress
- How to load file only in single post page through function.php?