You can upload variety of files to the server and have it displayed on the website. But in some cases, the server doesn’t support the file type. So you’ll get this error message that reads, “Sorry, this file type is not permitted for security reasons.”
If you’re stuck with this error, there are a couple of things you can do about it. In this article, learn how to fix this issue.
Edit wp-config.php File
The first way to deal with this issue is to edit the wp-config.php file. Here are the steps you should follow:
The settings in the wp-config.php are in place to protect your website server. After you’ve finished uploading the files, it’s recommended that revert back to previous settings to maintain integrity.
Edit functions.php
The second way to deal with this issue is by editing the functions.php file. This file controls nearly all of the functions of a WordPress website. You can either edit the functions already in the file or add new ones.
To edit the functions.php file, here are the steps involved:
Save the file and exit. Now you should be able to upload the files that were previously not supported.
Please note that editing core files like wp-config.php and functions.php is risky. So take a backup of your website before editing them. If the problem persists, contact your hosting provider to help you fix it.
If you’re stuck with this error, there are a couple of things you can do about it. In this article, learn how to fix this issue.
Edit wp-config.php File
The first way to deal with this issue is to edit the wp-config.php file. Here are the steps you should follow:
- Log into the cPanel
- Navigate into File Manager
- Click on “public_html” that you can see on the left-sidebar
- In the central panel, find for the wp-config.php file
- Right-click on it and select “Edit”
- In the pop-up window, confirm that you want to proceed by clicking on “Edit”
- When the file opens, add the following code:
Code:
define('ALLOW_UNFILTERED_UPLOADS', true);
Edit functions.php
The second way to deal with this issue is by editing the functions.php file. This file controls nearly all of the functions of a WordPress website. You can either edit the functions already in the file or add new ones.
To edit the functions.php file, here are the steps involved:
- Navigate into the public_html directory from File Manager
- You’ll see a folder named “WP-CONTENT”. It contains all the themes, plugins, media files, and associated files
- Click on the theme folder that your website is currently using.
- Scroll down till you come across the functions.php file
- Right-click on the file and click “Edit” to start editing
- Once opened, add the following code:
Code:
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' );
Please note that editing core files like wp-config.php and functions.php is risky. So take a backup of your website before editing them. If the problem persists, contact your hosting provider to help you fix it.