How to Fix the “Sorry, this file is not permitted for security reasons” WordPress Error
Are you trying to upload a file to your WordPress site but end up getting the “Sorry, this file is not permitted for security reasons” and/or “[filename.xyz] has failed to upload” or “Sorry, you are not allowed to upload this file type” message?
Though this error text might scare you and leave you thinking that you might have done something wrong, in reality, this is nothing to worry about. WordPress limits the types of files you can upload to your site for security reasons which can easily be solved by adding a small code to the wp-config.php file or using a free WordPress plugin.
Fluent Forms is the most beginner-friendly form builder. Download now and start crafting beautiful forms FREE!!!
The reason behind “Sorry, this file is not permitted for security reasons”
People get the “Sorry, this file type is not permitted for security reasons” or “you are not allowed to upload this file type” error message only when they try to upload a file that WordPress does not support by default.
Let’s have a peek at the file types WordPress approves —
Images: .jpg, .jpeg, .png, .gif, .ico
Documents: .pdf, .doc, .ppt, .pptx, .pps, .ppsx, .odt, .xls, .xlsx, .psd
Videos: .mp4, .m4v, .mov, .wmv, .avi, .mpg, .ogv, .3gp, .3g2
Audio: .mp3, .m4a, .ogg, .wav
Suppose you’re trying to upload a “Raining.f4v” video file to your WordPress Media Library. But as this is not included in the list above, you’ll see the
“Raining.f4v” has failed to upload.
Sorry, this file type is not permitted for security reasons, or
Sorry, you are not allowed to upload this file type — error text.
When you get this message, the first thing you need to do is — check the file name extension.
How to do that? Let’s have a quick look.
Check the file name extensions on different OS
To check the file name extension in windows 10, open the folder that contains your file and click on the ‘View’ option at the top of the window. Now check the ‘File name extensions’ box to see the file type if it’s not visible. After checking the box, you will see the extension after all your file names.
For Mac users, you need to go to the Finder app→Preferences→ Show all filename extensions and check the box to see the filename extensions.
Now that you can view the file name extensions, locate the file you were trying to upload and make sure it has the correct extension.
If the extension is incorrect, you can right-click and select the ‘Rename‘ option to change the file name and add the correct extension.
If you are still having problems uploading files to your WordPress site, you need to give permissions manually to allow WordPress to upload different types of files.
How to fix the “Sorry, this file type is not permitted for security reasons” WordPress error
There are two easy and efficient ways to solve this WordPress issue. We’ll show you both here for your convenience.
Solve “Sorry, this file type is not permitted for security reasons” or “you are not allowed to upload this file” —
- By editing your site’s wp-config.php file
- By using a free WordPress plugin
Use the wp-config.php file to add new permitted file types
It’s not as complicated as it sounds; you just need to copy-paste a piece of code to your site’s wp-config.php file.
Before doing so, you should make a backup for your wp-config.php file for emergency purposes. Once you’ve made a copy of your wp-config.php file, follow these simple steps to get permission to upload any file to your WordPress site.
Access File Manager via your hosting Cpanel or control panel.
Now open your public_html folder.
Find the wp-config.php file (which should be located in the same folder of wp-content, wp-admin, etc.) and right-click to edit
Scroll to the bottom of the file; you’ll see a comment:
/* That’s all, stop editing! Happy blogging. */
Just above this line, paste this line of code:
define('ALLOW_UNFILTERED_UPLOADS', true);
This is a very basic line of code that is literally saying to allow unfiltered file uploads.
Now save your changes to the file
Log out of WordPress and sign in again.
Finally, you should be able to upload any file type to your site now.
Now, if you try to upload a file not mentioned in the WordPress-permitted file types. For instance, you may need to upload a .woff font to your WordPress Media Library. Simply go to the Media Library and select the .woff file you want to upload; as simple as that.
However, this is a very simple and easy solution for your site. But if you don’t want to touch your website’s core files, we’ve got another option.
Install WP Extra File Types (Free)
If you aren’t comfortable editing your wp-config.php file and want more control over file upload types, you can use a Free WordPress plugin named WP Extra File Types.
Go to the link above to download or install and activate the plugin from your WordPress dashboard.
Now go to the WP Extra File Types from Settings and select/deselect the file types you want to permit to upload, in our case, we’ll tick the .f4v checkbox.
Don’t forget to save the changes. Now drop or select the file from your storage to upload, and you’ll see no error text from WordPress anymore.
Furthermore, you’ll get a whopping number of file types to choose from – just tick the boxes if you want to upload any format outside WordPress default file types.
If you don’t see the file type you want to upload to the list, you can add your custom file types as per your need. Happy uploading!
Wrapping Up
Everyone has their websites for different purposes. You may need to upload some files to your website that others may not. By default, WordPress limits the file types that can upload to your site for security reasons. So, whenever you try to upload a file excluded from the list, you’ll get the “Sorry, this file type is not permitted for security reasons.” error message.
We’ve shown the two easiest ways to solve this WordPress error, one is using a simple code in your wp-cofig.php, and another is using the free WP Extra File Types plugin to control allowed file types from your WordPress dashboard.
If these did not solve the problem, let us know in the comment section.
He loves to play in the arena of WordPress and learn new things every day. Whenever he’s not writing, he’s playing billiard or spending quality time with his family.
2 responses to “How to Fix the “Sorry, this file is not permitted for security reasons” WordPress Error”
-
[…] as the WordPress maintenance mode error – no need to worry; there is a quick fix for this WordPress error.If you don’t know the solution, errors like “Briefly unavailable for scheduled maintenance. […]
-
[…] Want to learn by default which files WordPress allows you to upload? […]
Leave a Reply
You must be logged in to post a comment.