Disable browser upload of media option for site users
-
I manage a site with multiple users who continue to upload images that are too large. I limited the upload to 180kb for the multi-file/flash uploader, I also used CSS to hide the link to toggle the “browser upload” option because this did not prevent someone from uploading images that are too large.
Does anyone know of a better way to prevent someone from using the browser uploader which bypasses the upload size limit currently in place?
To add, the site is hosted on WPengine, the plan we are using does not allow us to limit file size uploads unfortunately. They also do not allow an htaccess file, nor is there a php.ini file.
I’ve tried
@ini_set( 'upload_max_size' , '180K' );@ini_set( 'post_max_size', '180K');@ini_set( 'max_execution_time', '300' );in functions.php, but it does not work for me either. WPengine told me the lowest I can set it to is 1mb, something only they have access to do for us. But, this code is working to limit media uploads from the multi upload/flash uploader:
function seiu_limit_upload_file_size( $size ) {
$fileSize = '180'; // Provide fileSize in KB's, 512 value means 512 KBs
$size = (int)$fileSize * 1024; // Convert KB to bytes
return $size;
}
add_filter( 'upload_size_limit', 'seiu_limit_upload_file_size', 20 );
You must be logged in to reply to this topic.