How to Fix “Sorry, This File Type Is Not Permitted for Security Reasons” Error in WordPress

WordPress problem

Good Asked on February 12, 2020 in Wordpress.
Add Comment
  • 1 Answer(s)

    By default, WordPress allows you to upload images, documents, media, and compressed archives in the majority of the popular file formats. Therefore, whenever you try to upload unsupported file types to the library, you will get the ‘Sorry, this file type is not permitted for security reasons’ error. WordPress applies this restriction to protect its users from malicious files. Whether you upload them accidentally or purposefully, malicious files can affect your site negatively and expose its vulnerabilities to hackers.

    Fixing ‘Sorry, This File Type Is Not Permitted For Security Reasons’ Error

    1. Using a WordPress Plugin

    WordPress has plenty of Multipurpose Internet Mail Extensions (MIME) plugins that can help you add unsupported file types for upload. You can use  WP Add Mime Types free plugin.

    2. Editing wp-config.php File

    While you can edit the wp-config.php file to allow certain file types to enter the media library, this method will make your website less secure. Therefore, we advise you to revert any changes made once you have uploaded the unsupported file.

    1. Access your WordPress installation directory (in most cases, it’s public_html) via an FTP client or File Manager.

    Open the wp-config.php file and paste the following syntax anywhere above the line that says, ‘That’s all, stop editing! Happy publishing.’ Remember to save your changes.

    define(‘ALLOW_UNFILTERED_UPLOADS’, true);

    3. Editing the Theme’s functions.php File

    If you don’t want to tinker with the wp-config.php file, you can modify your theme’s functions.php file instead. By using the upload_mimes filter, you get to alter WordPress’s behavior towards not permitted file types.

    1. Access your WordPress installation directory (in most cases, it’s public_html) via an FTP client or File Manager.
    2. Navigate to wp-content -> themes, then access your current theme’s folder.
    3. Open the functions.php file and paste the following syntax in the file. Feel free to add your desired MIME types to the array. Don’t forget to save the changes.

    function my_custom_mime_types( $mimes ) {

     

    // Add new MIME types here

     

    $mimes[‘abiword’] = ‘application/x-abiword’;

     

    return $mimes;

     

    }

     

    add_filter( ‘upload_mimes’, ‘my_custom_mime_types’ );

     

    4. Contacting Your Hosting Provider

    In some cases, your hosting provider restricts certain file types to ensure security. If that’s the case, you can contact them to get the best solution to solve this error.

    Conclusion

    The ‘Sorry, this file type is not permitted for security reasons’ error is WordPress’ precautionary measure against malicious files. While it’s not encouraged, there are several methods of solving this issue and allowing your WordPress site to accept unsupported MIME types.

     

     

    Default Answered on February 12, 2020.
    Add Comment
  • Your Answer

    By posting your answer, you agree to the privacy policy and terms of service.