Fix ‘Sorry, This File Type Is Not Permitted For Security Reasons’ WordPress Error
access_time
hourglass_empty
person_outline

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

Did you try uploading a file to WordPress media library but ended up getting ‘Sorry, this file type is not permitted for security reasons’ error instead? Not to worry — this is a common error that you can solve in no time. In this article, we will uncover the cause of this error and how to fix it.

Why ‘Sorry, This File Type Is Not Permitted For Security Reasons’ Error Occur?

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

If you still want to upload unsupported file types to your WordPress site, there are four methods of solving the ‘Sorry, this file type is not permitted for security reasons’ error. However, please note that this restriction is meant to protect you and, therefore, shouldn’t be taken lightly.

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. The following tutorial will show you how to fix the error using the WP Add Mime Types free plugin.

  1. Install and activate WP Add Mime Types. Check this article for a thorough tutorial on how to install a WordPress plugin properly.
  2. From your WordPress dashboard, navigate to Settings -> Mime Type Settings.
  3. In the Add Values section, add your desired MIME name and type. Feel free to check out this article if you need help finding the correct file type. Finally, click Save.
    This image shows you how to use WP Add Mime Types plugin to add new MIME types and solve WordPress Sorry, this file type is not permitted for security reasons’ error.
  4. If the process is successful, the new MIME type should appear in the permitted list.
    This image shows you the successful result of adding a new MIME type to WordPress using WP Add Mime Types 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.
  2. 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’ 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. If you’re a Hostinger client, feel free to contact our customer success team via live chat, and they will gladly assist you with this matter.

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.

Do you find this tutorial helpful? Let us know in the comments section below!

The Author

Author

Domantas G. / @domantas

Domantas leads the content and SEO teams forward with fresh ideas and out of the box approaches. Armed with extensive SEO and marketing knowledge, he aims to spread the word of Hostinger to every corner of the world. During his free time, Domantas likes to hone his web development skills and travel to exotic places.

Related tutorials

Author

Plugin Author Reply

July 10, 2017

If you use the Wordpress plugin "WP Add Mime Types", please set the value below. abw = application/x-abiword The left value is a file extension value.

Author

Bakabaka Design Reply

November 13, 2017

As per this thread on the WordPress forums, the 'Allow unfiltered uploads' is a horrible idea because it creates a huge security problem. Just so you know.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Become a part of Hostinger now!