How to Fix ‘Sorry, This File Type Is Not Permitted For Security Reasons’ For a Website’s Server? Print

  • 0

Two Methods to Fix The Sorry, This File Type Is Not Permitted For Security Reasons Error

There are basically three methods, but you can make changes only in two. So, I am going to show you the solution.

Method 1). Edit the wp-config.php file

Before you make any changes, I suggest you revert changes after uploading a file you want to upload.

Here are a few steps to follow:

1). Open your hosting account's cPanel and look for the file manager.

2). From the left-sidebar, click on public_html and scroll down to find the wp-config.php file. Don't get confused with folders. Files are visible at the bottom of them.

3). Right-click and select "Edit".

4). Click on "Edit" from the popup that shows up.

5). You will see a new tab with codes of the wp-config.php file. Here is the code you have to add:

define('ALLOW_UNFILTERED_UPLOADS', true);

From the top-right corner, don't forget to click on save changes.

Method 2). Edit the functions.php File

The functions.php file controls all the functions of a WordPress website. You can edit existing functions and add a new function.

Here, I am going to generate a custom function for you that will allow the upload of unsupported files.

Here are a few steps to follow:

1). Since you're already in the public_html directory, open the WP-CONTENT folder that has all the themes, plugins, and media files.

2). Click on the theme folder that you're currently using. You might have multiple themes installed, but you have to edit the file of an active theme.

3). Scroll down to find the functions.php file and right-click to edit.

4). On a new tab, here is the required code you can add:

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' );

Note: Please don't forget to save changes.


Was this answer helpful?

« Back