Are you getting the “Sorry, you are not allowed to upload this file type” error on your WordPress website while uploading files on your website?
It’s a common WordPress error that many users get on their WordPress website. Let’s learn more about it.
What Causes This Error?
While uploading files on your WordPress website you might encounter a “Sorry, you are not allowed to upload this file type.” error. This message usually appears when you try to upload files with a different extension allowed by WordPress by default.
The default file types allowed by WordPress are:
- Images: .jpeg, .jpg, .png, .gif, .ico
- Documents: .pdf, .doc, .docx, .ppt, .pptx, .pps, .ppsx, .odt, .xls, .xlsx, .psd
- Audio: .mp3, .m4a, .ogg, .wav
- Video: .mp4, .m4v, .mov, .wmv, .avi, .mpg, .ogv, .3gp, .3g2
If you try to upload files with any other extensions you will encounter the “sorry, you are not allowed to upload this file type.” error.
How to avoid getting this error?
Now as we know the reason behind getting this error. Let’s see how to avoid getting the “sorry, you are not allowed to upload this file type.” error.
There are multiple ways to fix or avoid this error, so let’s look at all of them one by one.
Change file type before uploading on the Website.
To change the file extension before uploading on the website to avoid the “sorry, you are not allowed to upload this file type.” error. follow the steps given below:
On Windows – Locate the file you want to upload on the website. Right-click on the file and choose the rename option. Now modify the file name and ensure adding the correct file extension with the file name.
Windows may ask for confirmation after changing the file extension just confirm that.
On Mac – Find the file, then choose “Get Info” with a right-click. Change the file name and the preferred extension under “Name & Extension.” Verify the modification and respond to any alerts.
Update the WP-Config file
If you want to upload the file with the same file extension the best option is to modify the WP-Config file to accept the new file extension by WordPress. To do that follow the below steps:
Login to your cPanel Open the file manager and make changes to your WordPress’s wp-config.php file, which is often located in the public_html folder.
Now add the below line at the end of your WP-Config file.
define('ALLOW_UNFILTERED_UPLOADS', true);
Once you added this line to your WP-Config file hit the save button and now you can upload your desired WordPress file types on your website.
After uploading the appropriate files, it is advised to delete the new line you added to wp-config.php for security reasons. You can add the line again if you decide to upload additional later.