Encountering the "Sorry, you are not allowed to upload this file type" error can be frustrating, especially when you need to add specific files to your WordPress site.
This article will help you understand why this error occurs and provide you with effective solutions to resolve it.
Important Note: Please be aware that allowing such files to be uploaded may cause security issues, so we don't recommend you do this if you don't really need to.
The error Sorry, you are not allowed to upload this file type is usually displayed when custom font files are being added and it is not related to Divi.
The error comes from WordPress, which forbids certain files to be uploaded for security reasons.
You can find a full list of permitted files on the WordPress Documentation page.
Fixing the "Sorry, you are not allowed to upload this file type" error using plugins
You can use any of the following plugins to bypass the error:
Easy SVG Support (though this plugin is related to SVG, it should allow you to upload files that are not possible to upload due to security reasons)
Fixing the "Sorry, you are not allowed to upload this file type" error using the upload_mimes WordPress filter hooks
Before proceeding further with this method, it is important to know what file type you are trying to upload.
For example, if you are trying to upload a .csv file, this is a text/csv type. With that out of the way, you can use either a Child Theme for Divi or you can use the Code Snippets plugin to add the following PHP code:
function my_custom_upload_mimes($mimes = array()) {
$mimes['ttf'] = "font/ttf";
$mimes['otf'] = "font/otf";
return $mimes;
}
add_filter('upload_mimes', 'my_custom_upload_mimes');
Fixing the "Sorry, you are not allowed to upload this file type" error by modifying the wp-config.php file
Install and activate the Advanced File Manager plugin
Use the plugin and edit the wp-config.php file
After this PHP line:
$table_prefix = 'wp_';
Add the following line:
define('ALLOW_UNFILTERED_UPLOADS', true);
Save the changes
Upload the file again.
Important note: After the file(s) is/are uploaded, remove that line of PHP code from your wp-config.php file.
Edge cases
If none of the above works, contact your hosting support team. They will have to manually allow the file types you are trying to upload from the server's end.
If you are looking for better hosting, we recommend Divi Hosting. It is optimized and configured to ensure that any Divi site runs smoothly. In addition to that, the Divi theme will be preinstalled for you.