WordPress comes as the best content management platform that can handle any simple to complex media files. However, there may be times when you couldn’t upload some files. You will see different error messages once attempting to upload them to your WordPress site.
In this article, we will walk you through 3 common WordPress file issues, including unsupported file types, maximum file upload size, and HTTP error when uploading images to Media Library. Then we will discuss ways to fix these errors effectively.
#1 Unsupported File Type Error
WordPress permits you to upload certain file types to your site by default, such as:
- .png, .gif, .jpg for images
- .doc, .xls, .ppt, .pdf for documents
- .wav, .mp3, .mp4 for audios
- .mpg, .mov, .wmv for videos
However, if there is an attempt to upload any file types that are not listed above, you will receive this warning message “Sorry, this file type is not permitted for security reasons.”
The message says that you might upload a prohibited file type. This is not a serious issue because your website just wants to prevent you from uploading suspicious file types. Followings are some restricted file types in WordPress you should notice:
- Images: .svg, .bmp
- Documents: .psd, .ai, .pages
- Code files: .css, .js, .json
- Videos: .flv, .f4l, .qt
This restriction results from WordPress site protection. Hackers may attack your site or your server through malicious and harmful files.
It’s good for your site to have these file types restricted. So why do you find ways to fix this error? The main reason is to support disallow product file types. For instance, you own a WooCommerce store and want to import a product CSV file. Actually, WordPress doesn’t support this file type, so you have to correct it.
You can either seek help from a third-party plugin ur use .php files to avoid WordPress unsupported file type errors. While the former method is suitable for beginners, most professionals prefer the latter.
Use WP Extra File Types plugin to correct restricted file types errors
WP Extra File Types lets you add additional file types to the default list of WordPress supported file types. These steps may help you out:
- Go to Plugin → Add New in your WordPress admin dashboard
- Type “wp extra file types” in the keyword box to search for the plugin
- Install and activate the plugin
- Head to Settings → Extra File Types
- Tick the new file types you want WordPress to support
- Save your change
Wish to add other custom file types? Fill in the “Add your custom file types” table with the new file details like file description, file extension, and mime type.
Use WP File Manager plugin to upload unsupported file types
WP File Manager proves powerful and flexible to edit, delete, upload, download, zip, copy and paste files and folders directly from your WordPress backend. To upload restricted file types using this plugin, you need to:
- Install and activate the plugin
- Visit “WP File Manager” page
- Choose your desired files and edit, remove, copy, paste, etc
Use .php files to fix “Sorry, this file type is not permitted for security reasons” error
You can also use your .php file to add unsupported file types to your WordPress site. This solution stays useful when you already had favorite code snippets and want to apply them for all files.
To fix the “Sorry, this file type is not permitted for security reasons.” error, you can go to your site’s wp-config.php file and enable the option named ALLOW_UNFILLTERED_UPLOADS. These 3 steps guide you on how to do that.
- Log in to your WordPress (via FTP/SFTP) and look for the wp-config.php file
- Right-click on the file to edit or download it to your computer
- Add this code snippet above the /* That’s all, stop editing! Happy publishing. */ line
- Save your changes and re-upload the file if necessary
You have to log out of your WordPress account then log back in uploading any file type. You should notice that if you switch themes, your custom code, as a result, will not work. You need to create a child theme and add code snippets there.
#2 Maximum File Size Upload
Besides the restricted file types, there are also some permitted file types that couldn’t be uploaded. It’s might be because of their sizes. WordPress doesn’t allow you to upload media files larger than 2MB. As a consequence, you wouldn’t be able to build a WordPress video hosting site (like Youtube).
Fix the maximum file size error using Increase Max Upload File Size
The plugin automatically identifies upload limits set by WordPress and server or hosting providers then displays them.
- Install and activate Increase Maximum Upload File Size plugin
- Go to Increase Maximum Upload File Size under Settings
- Select size you want for your uploads
- Save your changes
Use .php files to increase WordPress maximum upload file size
To re-define the file size you want to upload, find the wp-config.php file and follow these instructions below to edit it.
Open the file and add this code:
@ini_set( 'upload_max_size' , '30M' ); @ini_set( 'post_max_size', '20M'); @ini_set( 'memory_limit', '40M' );
Remember to save your changes after adding the code.
#3 HTTP Errors When Uploading Images to WordPress Media Library
In WordPress, HTTP error refers to a code signaling that something went wrong during a file upload process. This error often happens when you attempt to add an image and other types of files to the media library.
Fix HTTP Error by editing .php files
Before making changes to your .php files, you need to ask your host to increase the PHP memory limit. Here is how to do so:
- Open your wp-config.php file
- Add the following code snippet above the /* That’s all, stop editing! Happy blogging. */ line
/** Increases memory limit */ define( 'WP_MEMORY_LIMIT', '256M' );
Make the decision wisely
You can see several error messages when trying to upload some files to your WordPress sites due to a couple of reasons. Some file types are not supported by WordPress by default. Some others are too large compared to the maximum file upload size.
There are 2 different paths you can take to correct these file errors: use a plugin or edit your .php files. Using plugin helps fix restricted file types, maximum file upload size, and HTTP errors without hassle. Editing .php files, meanwhile, requires you to add some code snippets. If you don’t create a child theme edit .php files there, all your changes won’t work once you update your theme.
Still have questions about WordPress file errors and how to fix them? Leave a comment to let us know.