Have you ever experienced the “Sorry, this file type is not permitted for security reasons” error? This file upload error may happen when working with file upload WordPress Plugins. For example, I recently worked with WP User Frontend Pro and needed to upload .nes (NES Game Roms) files, and I discovered multiple things about file uploads in WordPress. The following explains the error and a few different ways to resolve the error.
By default, WordPress limits the image, video, document, and audio file extensions you can upload with a WordPress website. The following are permitted file extensions accepted by WordPress.
Image File Extensions: .jpg, .jpeg, .png, .gif, and .ico
Video File Extensions .mp4, .m4v, .mov, .wmv, .avi, .mpg, .ogv, .3gp, and .3g2
Document File Extensions: .pdf, .doc, .ppt, .pptx, .pps, .ppsx, .odt, .xls, .xlsx, and .psd
Audio File Extensions: .mp3, .m4a, .ogg, and .wav
You can override these restrictions by adding this line of code to your site’s wp-config.php file.
1 2 3 |
define('ALLOW_UNFILTERED_UPLOADS', true); |
When adding the PHP code to the WordPress wp-config.php file, make sure it is just above the /* That’s all, stop editing! Happy blogging. */ code line as illustrated below in the following image.
Another alternative to allowing uploading otherwise restricted file extensions in WordPress is the WP Extra File Types Plugin. However, I think it is important to note that after reviewing the WordPress Plugin Repository, this particular WordPress Plugin has not been tested with the last three versions of WordPress and was last updated two years ago.