The vast majority of us don't really like unnecessary stress. We tend to avoid stressors at all costs, oftentimes so much that we actually get stressed out in the process. Jokes aside, avoiding unnecessary (technical) problems at all costs especially holds true in the world of digital marketing and website ownership.
When you have an online business to run or a blog to take care of, the last thing you want is a pesky file or a line of code preventing you from performing your daily task as supposed to.
That being said, when you’re trying to add a file to your WordPress Media Library just to receive the message in the title, you have all the right to freak out and to get angry.
Luckily, there are ways you can resolve this issue quickly and get back to your daily routine, and in this blog post entry, we will show you how to overcome this problem with ease.
What is the “Sorry, this file type is not permitted for security reasons” and what triggers it?
As the name implies, WordPress doesn’t let you add just any type of file to your media library by default. Fortunately, however, you can add a small code snippet to your files or can take advantage of a few plugins to expand the supported file type list and won’t have these problems in the future.
So, as said above, certain file types will trigger the message, as the platform won’t let you add just any type of media files to your library due to security reasons.
If you upload a file that’s not supported by WP by default, you will see the ugly “Sorry, This File Type Is Not Permitted for Security Reasons” error message.
Here are the file types you can use for different media.
For images, the default file formats are as follows:
For videos, you have more options, but still, you are limited to fo the following:
When it comes to documents, here are your file format options:
- .ppt, .pptx, .pps, .ppsx
- .xls, .xlsx
Lastly, in the case of audio here’s what you can work with by default:
As such, if you’re trying to upload a certain file format that’s not present on the above list, you’re pretty much bound to run into the “Sorry, this file type is not permitted for security reasons” error message, or get its laconic cousin, the “[filename] has failed to upload” message.
This can be a pretty nerve-wracking problem, especially in cases when you want to add something custom to your site. For instance, you may want to use a set of custom fonts for your WordPress blog, and you intend to upload a custom font file in .ttf or .woff formats.
As you now see these formats aren’t supported by WP by default, so you will receive the dreaded error message instead of letting you upload the file in peace.
Fixing the issue “This File Type Is Not Permitted for Security Reasons”
Fortunately, there are actually two ways you can go about fixing the issue and expand the supported file list in WordPress.
You can either:
- Edit the website’s wp-config.php file
- Or use a free WordPress plugin
Editing the wp-config.php file to add new permitted file types
So, in WordPress you can take advantage of an ALLOW_UNFILTERED_UPLOADS option that you can enable by editing the wp-config.php file. Once you enable this option, you will be able to upload virtually any file type to your Media Library without any hold ups.
Setting up that option is pretty easy, but it’s highly recommended that you backup your website before commencing.
So, to get started with the process, connect to your site through FTP/SFTP. Once done, look for the wp-config.php file in the root folder, then download the file with a right-click to your computer.
When done with that, you should add a particular code snippet above the /*That’s all, stop editing! Happy blogging. */ line. Make sure to save your changes. And re-upload the file. Now, go to your WP dashboard, log out of your account and log back in.
Once you’re done with all this, you should be able to upload any file type without triggering any error messages.
Taking the plugin route
If you’re not really into the coding side of things and don’t want to mess around with editing and all that jazz, you can also use plugins, which allow you to have more control over the exact file types you can add to your site’s Media Library.
Once you install the plugin, chances are, you will be seeing a long list of different file types. Here, you can customize your options by checking the boxes next to the formats you will want to work with in the future. Once you checked all the preferred file types, just save your changes and get back to work.
There’s also a chance that you won’t see the specific file type on the list. Most plugins will also let you solve this problem, as they offer you the chance to add your own custom file types as well.
Also, there are instances where you will want to use specific plugins for specific file types. For example, if you want to use an SVG file, you will want to use a safe SVG plugin. As a matter of fact, if you’re looking for such a plugin, make sure to use one that not only enables you to upload these files to your Media Library but also sanitizes them during upload so everything keeps running smoothly.
Putting it all together
By default, the WordPress platform will limit the types of files you can add to your site. WordPress does this for security reasons, and when you try to upload a file type that’s not on the supported list, you will receive the error message from the title.
One way to solve the problem is by adding the ALLOW_UNFILTERED_UPLOADS code snippet to your wp-config.php file. This will enable you to upload everything without any restrictions. Conversely, you can also choose to use plugins that will enable you to add extra file options. Apart from expanding your supported file list, the latter approach will also enable you to have better control over which file types you will let your site support.
Lastly, if all this feels confusing or just seems like too much tech work, you can always reach out to your web development partners who will hammer out this problem in a blink of an eye.