How to Fix “Sorry This File Type Is Not Permitted for Security Reasons”

Written By John Ravi

On August 28, 2021
"

Read more

Stop doing all by yourself. Save time and money by hiring our 10+ years experienced virtual professionals!

Are you a regular WordPress user? Then, you may have seen the “Sorry, this file type is not permitted for security reasons” error when you try to upload a document to the WordPress library. Several users have seen this error pop up on their screens. And as soon as they see them, they mostly go into panic mode. The worst conclusions come to mind like have I uploaded malware? Is the file corrupted? Will my WordPress website be blocked? So, if you are seeing this error appear the first time, the panic is understandable. However, the good news is, this message may be appearing because WordPress does not support the type of file you tried to upload. This is one of the most significant reasons behind the “WordPress, sorry, this file type is not permitted for security reasons” error. 

Similar to other errors like ERR_CONNECTION_REFUSED Error, this one can be resolved too. An incompatible file type is the most common reason behind this error. And there are some quick fixes for that. In this article, we will look at the reason behind the “sorry this file type is not permitted for security reasons” error. And we will also look at which file types are allowed by WordPress, along with how you can fix it if you have been experiencing this error. All the solutions we discuss in this guide are no code, and anyone with basic technical knowledge can resolve this error. So, let’s dive in and look at all the possible solutions to resolve the “sorry this file type is not permitted for security reasons” error. 

 

What Causes The “Sorry, This File Type Is Not Permitted For Security Reasons” Error?

 

Sorry, This File Type Is Not Permitted for Security Reasons

Users can only upload certain types of files on WordPress due to security reasons. So, if you try to upload a file that is not supported by WordPress. The “sorry this file type is not permitted for security reasons” error will pop up. For instance, if you try to upload an AVIF format file to WordPress, you will see this error message appear on your screen. Since this is a new image format, and it produces compressed images without compromising the quality of the image. However, this image format is not permitted by WordPress. Even though this format can be a great solution to upload high-quality compressed images, you still cannot use this on WordPress. As the platform does not support it. 

Thus, if you try to upload this image in the WordPress library, you will get the “sorry this file type is not permitted for security reasons” error. But, you don’t need to worry, this error can be easily resolved. If you only use the image formats permitted by WordPress. The chances of getting the “sorry this file type is not permitted for security reasons” error will be reduced. So, one of the easiest ways to fix this issue is by using the permitted image formats. But what are the image formats permitted by WordPress? Let’s look at all the file types WordPress allow below:

 

What File Types Are Allowed in WordPress?

 

WordPress permits a range of file types for all images, documents, audios, and videos as well. These file types include all the common formats and are known as MIME (Multipurpose Internet Mail Extensions). These types enable the browsers to identify which files have been uploaded to a web page. So, when you upload a PNG file, the browser will be able to identify it as an image, and will not confuse it as an audio or video file. Thus, if you only use the file types allowed by WordPress, you may not experience the “sorry this file type is not permitted for security reasons” error. And the following are the file types supported by WordPress. 

 

Images 

 

  • .jpg
  • .jpeg
  • .png
  • .gif
  • .ico

 

Document

 

  • .pdf 
  • .doc, .docx 
  • .ppt, .pptx, .pps, .ppsx 
  • .odt 
  • .xls, .xlsx 
  • .psd 

 

Audio

 

  • .mp3
  • .m4a
  • .ogg
  • .wav

 

Video

 

  • .mp4, .m4v 
  • .mov 
  • .wmv 
  • .avi
  • .mpg
  • .ogv 
  • .3gp
  • .3g2

 

Sometimes, you may get the “sorry this file type is not permitted for security reasons” error, even when you are using the permitted file types. However, there are some quick fixes you can use to resolve these errors. 

 

Solutions To Fix The “Sorry, This File Type Is Not Permitted For Security Reasons” Error

 

If you have been experiencing the “sorry this file type is not permitted for security reasons” error every time you try to upload a file. We have compiled a list of solutions to resolve it. You can use these methods to resolve the error and ensure it does not occur in the future. If you have been experiencing slow WordPress admin, you can check out our article WordPress Admin Slow – How To Tackle This Issue With Ease? For a quick fix. 

 

Edit the wp-config.php to upload any type of file

 

WordPress Sorry, This File Type Is Not Permitted for Security Reasons

If you are looking to permit all file types to be uploaded to your WordPress library. Then, you only have to add a single line of code to your wp-config.php file. The process is simple to follow and very easy, but if you are new to this, there is a chance that something may go wrong. Thus, you should always make a backup of your wp-config.php file before you edit it. As just a small error can make your website inaccessible. After you have successfully made a copy of your wp-config.php file, follow the process given below to allow all types of files to be uploaded in the WordPress library. 

Start by accessing the file manager from the hosting control panel. From there open the public_html folder. Upon opening, find and right-click on the wp-config.php file, then choose the edit option. After you have chosen the editing option, scroll to the bottom of the file, and find the following line “ /* That’s all, stop editing! Happy blogging. */”. Once you have located this line, paste this code “define(‘ALLOW_UNFILTERED_UPLOADS’, true);” and save the changes. After you have saved these changes, sign back to the WordPress dashboard, and you will be permitted to upload any type of file in the library. 

Even though this is an easy solution, it might not be ideal for every website. So, if your website has several users who upload on the WordPress site. Then, it is better to only have certain types of files permitted. Thus, you should look at other solutions to fix the “sorry this file type is not permitted for security reasons” error. 

 

Check the extension of your file type

 

One solution that does not involve changing or altering your WordPress settings or PHP files is by checking the extensions of files you are trying to upload to the WordPress library. Sometimes the extensions are accidentally changed when you are saving the file. And this extension can be a significant reason why you are getting the “sorry this file type is not permitted for security reasons” error. 

For instance, if you try to upload a JPEG file as a PNG file, the “sorry this file type is not permitted for security reasons” error will pop up and you won’t be able to upload that file to the image library. This issue is easy to fix. All you have to do is fix the extension, and then try to upload the file. However, if you still face a problem uploading it, then the real cause is something else. Read on to try out other solutions and fix the “sorry this file type is not permitted for security reasons” error. 

 

Install plugin to add the permitted file types

 

Sorry, This File Type Is Not Permitted for Security Reasons

If you don’t want to edit your wp-congig.php file every time the “sorry this file type is not permitted for security reasons‘ ‘ error pops up. Then, you can use a plugin to add the permitted files to your website. Plugins like WP Add Mime Types and File Upload Types by WPForms can be used to add the permitted files to the WordPress website. Both of these plugins are available in the official WordPress directory, and these plugins are highly rated. However, if you are looking for a user-friendly option, the File Upload Types may be perfect. As it is easy to use, and will not require extensive IT skills. 

To use them, you can install and activate the plugin in your WordPress dashboard. After you have installed them, you will be redirected to the plugins page. Once there, go to the file upload types and click settings. You will find a box next to the file types you want to upload on your WordPress website. Check the ones you want, you can even add your custom files as well. After you have made the changes, save the settings, and you may get rid of the “sorry this file type is not permitted for security reasons” error.

 

Change your multisite network settings 

 

In case you are running a multisite installation. Then, you can add more permitted file types to your WordPress website. Multisite is a network of sites that share the same WordPress installation core files. So, you can edit the settings and allow more files on your website. To make the changes, start by clicking on Settings, and navigate to “network settings” within your dashboard. Once there, scroll down to the “upload settings”. 

Then, locate the input field which you can find next to the “upload file types”, and you can add extensions for the files types you want to upload. Once you have made all the changes, save them. After saving, users from any site within the network will be permitted to upload the file types you added. However, if you are running a single site WordPress installation, this feature will not be available to you. 

 

Edit the functions.php file in themes and modify the permitted file types

 

Sorry, This File Type Is Not Permitted for Security Reasons WordPress

By using the Upload_Mimes Filter you can permit only certain types of files to be uploaded on your WordPress website. And you can implement this solution by accessing the file manager from the hosting control panel. From there, open the wp-content folder, and open the themes folder. Find and right-click the function.php file, and choose the edit option. Once there, scroll down to the bottom of the file and paste the following code 

 

“function cc_mime_types($mimes) {

    // New allowed mime types.

  $mimes[‘svg’] = ‘image/svg+xml’;

  $mimes[‘svgz’] = ‘image/svg+xml’;

  return $mimes;

}

add_filter( ‘upload_mimes’, ‘my_custom_mime_types’ );”

This code will let you add SVG and SVGZ files. If you want to add any other file types to your WordPress website, you can edit the code snippet, and add the extension of the file within the code. 

 

Contact your hosting provider 

 

If you have tried all the solutions we have mentioned above, and the “sorry this file type is not permitted for security reasons” error is still not resolved. Then, it is because your provider has strict limits on the file types that are permitted to the WordPress library. If this is the case, the methods we have discussed will not work, and you will have to contact your provider for customer support. You can ask them to allow you to add any type of file to the website. If you don’t want to face this issue in the future, you should choose a reliable hosting provider like Kinsta or Cloudflare. Have a look at our Kinsta WordPress Hosting Reviewed, to decide if this provider is an ideal one for you. 

 

Bottom Line

 

The “sorry this file type is not permitted for security reasons” error can hamper your experience, and limit you from uploading your preferred file types to the WordPress website. This issue can be frustrating for the admin. However, the silver lining is that this error can be resolved. You do not need extensive IT skills or professional help to resolve the “sorry this file type is not permitted for security reasons” error. With our quick methods above you can fix this issue and add any type of files you want to your WordPress website. Make sure only to upload secure files to your website so you don’t compromise the security of your website. We hope this article has helped you resolve the error and fix your issue with ease. 

 

Related Reading- How to Fix “Sorry, You Are Not Allowed to Access This Page”

Stop doing all by yourself. Save time and money by hiring our 10+ years experienced virtual professionals!

Guides

  • WooCommerce not sending emails
  • WordPress Speed Optimization
  • Fixing Site Issues