Uploading Image Not Working Security Reasons Wordpress
Are you trying to upload a file to your WordPress Media Library only to be met with a message telling you "Sorry, this file type is not permitted for security reasons" and/or "[filename] has failed to upload"?
Equally the message implies, WordPress limits the types of files that y'all can upload to your site for security reasons. However, by adding a small code snippet to your site's wp-config.php file or using a free plugin, you lot can manually expand the list of allowed file types so that you lot're able to upload whatsoever type of file.
Here'due south what you'll learn in this article:
- More most the "Deplorable, this file type is non permitted for security reasons" bulletin
- How to fix the "Sorry, this file blazon is not permitted for security reasons" message in WordPress
What Triggers the "Sorry, this file type is not permitted for security reasons" Message?
As nosotros explained above, WordPress' default configuration limits the types of files that you can upload to your site for security reasons.
The "Sorry, This File Type Is Non Permitted for Security Reasons" Error Bulletin in WordPress:
You become the "Sorry, This File Blazon Is Not Permitted for Security Reasons" error message when y'all try to upload a file blazon that'due south not supported in WordPress past default.
WordPress limits the file types you tin upload through your site'due south admin — images, videos, documents, sound — for security reasons.
By default, the file types that you lot can upload are:
Images:
- .jpg
- .jpeg
- .png
- .gif
- .ico
(Suggested reading: JPG vs JPEG: Agreement the Well-nigh Common Image File Format)
Videos:
- .mp4
- .m4v
- .mov
- .wmv
- .avi
- .mpg
- .ogv
- .3gp
- .3g2
Documents:
- .dr.
- .ppt, .pptx, .pps, .ppsx
- .odt
- .xls, .xlsx
- .psd
Audio:
- .mp3
- .m4a
- .ogg
- .wav
If y'all're trying to upload a file blazon that'south not on the listing above, you're likely going to run across the "Sorry, this file type is not permitted for security reasons" mistake. Or, y'all'll also come across information technology as "[filename] has failed to upload".
For example, if you're trying to use your own custom fonts on your WordPress site, y'all might be trying to upload a custom font file to WordPress in the .tff and/or .woff formats. Because those formats are not allowed by default, WordPress will show yous the "Sorry, this file type is not permitted for security reasons" error instead of letting you upload them.
Hither's an instance where we tried to upload a .woff file to our exam site:
How to Gear up the "Sorry, this file type is non permitted for security reasons" Error in WordPress
Below, we'll show you lot two ways how to gear up the "Lamentable, this file type is not permitted for security reasons" error in WordPress:
- Past editing your site's wp-config.php file
- By using a free WordPress plugin
1. Add together New Permitted File Types Using wp-config.php
WordPress includes an ALLOW_UNFILTERED_UPLOADS pick that y'all can enable in your site'south wp-config.php file. Once enabled, y'all'll exist able to upload whatsoever file type to your WordPress Media Library.
Subscribe At present
Hither'southward how to set it up – just first, considering you'll exist editing your wp-config.php file, we'd recommend backing up your site before proceeding.
To go started, connect to your WordPress site via FTP/SFTP. Your site's wp-config.php file is located in the root binder, which is the same folder that has the wp-admin and wp-includes folders.
Right-click to edit the file, or download information technology to your computer:
Then, while editing the wp-config.php file, add the following code snippet in a higher place the /* That's all, stop editing! Happy blogging. */ line:
define('ALLOW_UNFILTERED_UPLOADS', true);
Brand sure to salvage your changes and re-upload the file if needed.
To stop the procedure, yous'll need to go to your WordPress dashboard and log out of your WordPress account. Then, y'all can immediately log back in.
After you've logged out/in, you should be able to upload whatsoever file without triggering the error bulletin:
ii. Employ the Free WP Extra File Types Plugin
If yous'd adopt non to edit your wp-config.php file and/or you want more than control over exactly which file types can be uploaded to your site, you can utilise the free WP Extra File Types plugin at WordPress.org
Once y'all install and activate the plugin, become to Settings → Actress File Types in your WordPress dashboard.
There, you'll see a lengthy list of file types. Check the box next to the file type(s) that you want to be able to upload and so click Salvage Changes at the bottom:
If you lot don't see the file blazon that y'all'd like to upload on the listing, you can also add your own custom file types at the bottom of the plugin'south settings list:
Alternative Plugins
In some instances, there may be ameliorate culling plugins to enable specific file types. For case, in our tutorial on how to enable SVGs in WordPress, nosotros recommend the free Safe SVG plugin. This not but enables the SVG filetype in the WordPress media library, it besides sanitizes them upon upload.
Summary
Past default, WordPress limits the file types that you lot tin can upload to your site for security reasons. If you try to upload a file type exterior this listing of default file types, yous'll see the "Deplorable, this file type is non permitted for security reasons." message.
One mode to fix the issue is to edit your wp-config.php file and add the ALLOW_UNFILTERED_UPLOADS code snippet to let unfiltered uploads. Or, you can also use the free WP Extra File Types plugin to control allowed file types from your WordPress dashboard.
Finally, if, after allowing new file types, yous still can't upload your file because of its size, you might want to check out our additional guides on:
- How to Increase the WordPress Maximum Upload File Size
- How to Set the uploaded file exceeds the upload_max_filesize directive in php.ini Error
And don't forget, you could also upload the file via SFTP if needed.
Save time, costs and maximize site operation with:
- Instant assistance from WordPress hosting experts, 24/7.
- Cloudflare Enterprise integration.
- Global audience reach with 29 information centers worldwide.
- Optimization with our built-in Application Performance Monitoring.
All of that and much more, in 1 program with no long-term contracts, assisted migrations, and a 30-day-money-back-guarantee. Check out our plans or talk to sales to find the program that's right for you.
Source: https://kinsta.com/knowledgebase/sorry-this-file-type-is-not-permitted-for-security-reasons/