• Hi

    This might seem obvious to most people using this uploader but it wasn’t to me, and I couldn’t find any info on it easily. I wanted to restrict the uploader to allowing only jpegs. So in case it’s useful, here’s how to do it. If you want to restrict to other types you just have to list other MIME-types in the spot indicated in the code.

    Use this in your functions.php:

    //function to restrict upload filetypes to jpeg
    add_filter('fu_allowed_mime_types', 'my_fu_allowed_mime_types');
    function my_fu_allowed_mime_types( $mime_types ) {
         $mime_types = array(
    
              // Lists the allowed MIME types; all others are excluded
              'jpg|jpeg|jpe' => 'image/jpeg',
              // add other types here if you want
         );
    return $mime_types;
    }

    https://ww.wp.xz.cn/plugins/frontend-uploader/

The topic ‘Restrict file types’ is closed to new replies.