Have you ever tried to upload a file in your wordpress Media section, in wordpress admin dashboard, and got an error ? Was the error “Sorry, This File Type Is Not Permitted for Security Reasons” ? If yes, in this article you will find out a few ways to overcome this error or go around it. There are many ways to make this go away, and below you will find one of the most easy ones to implement. See below 3 ways to go around the “Sorry, This File Type Is Not Permitted for Security Reasons” error in WordPress:

 

Why does the error “Sorry, This File Type Is Not Permitted for Security Reasons” even appearing anyway ?

Normally the reason behind this is very simple. WordPress has a way of restricting certain file types from uploading. Restricted file types are types of files which might be harmful if someone unauthorised is uploading them, or can have hidden malware if someone that is bad intentioned uploads them. You can read more about the wordpress file upload system here.

This issue is inside wordpress more to protect you agains bad intentioned people, or unauthorised people uploading malware to your dashboard. But sometimes you really need to allow uploading certain file types. See below 3 ways of bypassing this error:

 

1. Using the filter called “Upload_Mimes” in your theme or plugin

This method is quite simple, you can use the code below in your theme’s functions.php file or your plugin’s main file.

add_filter( 'upload_mimes', 'sitemile_custom_mime_types' );

function sitemile_custom_mime_types( $current_mimes ) {

// New allowed mime types.
$current_mimes['svg'] = 'image/svg+xml';
$current_mimes['svgz'] = 'image/svg+xml';

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

return $current_mimes;
}

 

 

2. Adding one line of code to wp-config.php

This method requires access to your ftp or cpanel access (that has file explorer capability). All you have to do is browse in the root of your website, and locate the wp-config.php and add this line of code. Thats it!

define('ALLOW_UNFILTERED_UPLOADS', true);

 

 

3. Using a plugin from wordpress repository


The wordpress plugin directory gives you thousands of plugins from which you can choose. For example here is a simple plugin that can work for this purpose. The name of the plugin is WP Add Mime Types.
You can try other plugins too if you check the wordpress plugin directory.

This entry was posted in Informative. Bookmark the permalink.

Leave a Reply