Have you got an error like “Sorry this file type is not permitted for security reasons” when you were uploading any file to your media library?

Well, one of our clients has faced this error while uploading a file into the media library, and maybe many more people have faced this same issue.

That’s why today we have created this article on how to fix “Sorry This File Type Is Not Permitted for Security Reasons” Error in WordPress.

So let’s get into it.

Why “Sorry This File Type is not Permitted for Security Reasons” Error comes out.

While uploading any file through media library many users see this error, and they stuck into it.

but there are some small mistakes that caused by some hosting providers or by some other WordPress security reasons.

Probably you may have seen the following, error while uploading any file on the media library.

This error occurred due to WordPress limits the types of files that you can upload to your site for security reasons.

Sometimes WordPress checks the file “MIME type” for upload was made, which may cause an error on upload for some file types (specifically non-image files).

Error Appears due to wrong file format.

The message Sorry, this file type is not permitted is when you try to upload a file with another format that is not permitted, usually, the error will appear.

By default, WordPress allows you to display the following given file formats.

  • Image file Types: .jpg, .jpeg, .png, .gif, .ico, etc.
  • Audio file Types: .mp3, .m4a, .ogg, .wav, etc.
  • Document file Types: .pdf, .doc, .ppt, .pptx, .xls, .xlsx, .psd, etc.
  • Video file Types: .mp4, .m4v, .mov, .mkv, .avi, .mpg, etc.
  • Other File Types: .Zip

We will tell you 5 methods to fix this error.

  1. Using a free WordPress Plugin.
  2. By editing the wp-config.php file of your site.
  3. Edit Your Theme’s functions.php File.
  4. Add allowed file types by changing the Multisite WordPress settings.
  5. Contact a developer.

If you upload a file other than the allowed format, an error will appear. To solve this problem, please go to the steps given below.

1- Using a free WordPress Plugin

There are various plugins that are capable of fixing your uploading error, Plugins like Enhanced Media Library and Mime Types Plus.

You can use any of the plugins, we are going to use Mime Types Plus plugin, to add new permitted MIME types for upload.

Go to the Plugin area and install & activate the Mime Types Plus Plugin. Dashboard > Plugins > Add New

After Installing the plugin now follow the instructions below.

First navigate to Dashboard > Mime Types Plus > Edit Mime Type, as shown on the screenshot below.

Now to have to add new MIME Type, so for that, you have to add Extension, Mime Type, and File Type.

  1. First add Extension type, like we have added webp.
  2. Now add Mime Type, as webp/image
  3. Now select the file type that you want to add as an uploadable file.
  4. Click on add to create your file type.
“Sorry, This File Type Is Not Permitted for Security Reasons”

After adding the file type, you will able to upload a prohibited file type.

2- By editing wp-config.php file.

If the plugin doesn’t work, you can edit the wp-config.php file and allow you to upload all types of files, on your WordPress website.

For editing the wp-config.php file, follow these instructions.

  • Access files via File Manager or FTP client.
  • Now find the wp-config.php file and click on edit.
“Sorry, This File Type Is Not Permitted for Security Reasons”

Now You have to add the following code below in the line above /* That’s all, stop editing! Happy publishing. */

define('ALLOW_UNFILTERED_UPLOADS', true);

After editing file successfully, don’t forget to click on the save changes.

After editing the wp-config.php file you can upload any type of prohibited files.

3- Edit Your Theme’s functions.php File.

Another option is by editing the theme’s functions.php File. Let’s know this method, after that you will be able to upload your desired files.

Edit your Theme’s functions.php File by the following method.

  • Access files via File Manager or FTP client.
  • Now find the functions.php File and click on edit.

After opening Theme’s functions.php file, now add the following code.

function my_custom_mime_types( $mimes ) {
	
        // New allowed mime types.
        $mimes['svg'] = 'image/svg+xml';
	$mimes['svgz'] = 'image/svg+xml';
        $mimes['doc'] = 'application/msword'; 

        // Optional. Remove a mime type.
        unset( $mimes['exe'] );

	return $mimes;
}
add_filter( 'upload_mimes', 'my_custom_mime_types' );

Now add your MIME types and their corresponding extensions to the array, under // New allowed mime types

You can also add MIME types you wish to prohibit to the optional Remove a mime type section.

This method will help you to upload your prohibited files.

4- Add allowed file types by changing the Multisite WordPress settings

If you’re a big company or you manage multiple websites, then you will definitely have a WordPress Multisite.

You can Fix the “Sorry This File Type Is Not Permitted for Security Reasons” Error in WordPress by using Multisite settings.

Unlike WordPress installation with a single site, Multi-Site has a setting that allows you to easily allow file uploads that are not allowed by WordPress.

To access your Multisite Settings, go to Dashboard > Settings > click on network settings, as shown on the screenshot below.

“Sorry, This File Type Is Not Permitted for Security Reasons”

Under the Upload Settings heading, you will find a configuration for file upload types where you can add extensions for the types of files you wish to allow.

Add your file type on the Upload file types section.

After adding your file types, click on the Save Changes button, and by saving your settings you will able to add permitted file types for all the sites in your multisite network.

5- Contact a developer.

If you didn’t find anything that solves your problems, and If you have tried all way above but the error still hasn’t disappeared which we have discussed above, you can contact a developer, they will fix your problem.

However, you can also try some more methods given below.

  • By updating or deactivating your themes.
  • By deactivating plugins.

Conclusion-

So this is the article on how to fix the “Sorry this file type is not permitted for security reasons.” error in WordPress. you can try any of the above methods.

If you have any questions regarding any issue, do not hesitate, just comment down below, we will help you to solve your problem. Thanks for reading this blog.

Read More-