Send an e-mail notification to custom user role when a file is uploaded to uploads folder

You could use the wp_mail function https://developer.wordpress.org/reference/functions/wp_mail/ to send an email to anyone after the file is successfully uploaded in your directory. You do not need any action here Add it your code after the file is uploaded successfully if(empty($errors)==true){ move_uploaded_file($file_tmp,”/$user_dirname/”.$document); echo “The file was uploaded successfully!”; wp_mail(..); }else{ print_r($errors); } }

Multisite adjust uploads like (/upload/%alphanumeric_id%/%file_type%/%blog_ID%)

Ok this is my solution for now – but how do I add the generated alphanumeric_id as add_post_meta($post_id, ‘alphanumeric_id’, $randomString); to the related attachment? /*===================================================================================*/ /* function change the upload for multi-lang /*==================================================================================*/ function bZive_handle_upload_prefilter( $file ) { add_filter(‘upload_dir’, ‘bZive_custom_upload_dir’); return $file; } function bZive_handle_upload( $fileinfo ){ remove_filter(‘upload_dir’, ‘bZive_custom_upload_dir’); return $fileinfo; } /** * Force … Read more

How to allow .bin files upload?

This code would allow you to upload .bin files. /** * Allow upload bin mime type */ add_filter( ‘upload_mimes’, ‘wpse_287673_allow_upload_bin_mime_type’, 1, 1 ); function wpse_287673_allow_upload_bin_mime_type( $mime_types ) { $mime_types[‘bin’] = ‘application/octet-stream’; return $mime_types; } This code is tested and is working for me, but it might be some differences for you since we are allowing … Read more

admin notice on Insert Media popup screen

I’m unaware of any hooks that tap in in the pop up, but there might be. If not, you could use some jQuery to put your message on the pop-up when Add Media is clicked. I was able to with the following: add_action(‘admin_head’,’myplugin_add_media_popup_notice’); function myplugin_add_media_popup_notice() { ?> <script> jQuery(window).load(function() { // the MEDIA buttons you … Read more

Large amount image data transfer

Yes, to answer your question as it is: It is possible. If you’re also looking to find out HOW, you would need to tell us more information about your hosting though. Do you have ssh access, FTP acess? Is it shared hosting or do you have full access? If you have SSH here’s what I … Read more

Get uploaded image and attach it to the new post

You have to use the javascript FormData object to upload files via ajax. A simple tutorial is provided here. In PHP the file will be available via the globals $_FILES and $_POST. Additional to the tutorial the WordPress specific data “action” (and maybe “nonce”) have to be added to the formData object: formData.append(‘action’, ‘add_your_action_here’); // … Read more