Cloud Service >> Knowledgebase >> WordPress >> How to Fix Error in WordPress, “Sorry You are Not Allowed to Upload this File Type”
submit query

Cut Hosting Costs! Submit Query Today!

How to Fix Error in WordPress, “Sorry You are Not Allowed to Upload this File Type”

The “Sorry, you are not allowed to upload this file type” message in WordPress is very frustrating when you are uploading media files such as pictures, documents, video clips, etc. This error normally come up because of the security reasons that WordPress has put in place to prevent such uploads. But there are some ways to hit upon the issue and provide the facility to anyone to upload specific type of file.

Understanding File Type Restrictions

When the user starts with WordPress, this includes a series of security purposes, which in fact consist a set of restrictions towards specific file types. With the purpose of blocking the accessibility of such files, users can't upload the potentially harmful or executable files that would be detrimental to the website's security. Those permitted file types in the default WordPress are considered secure:

- Images: jpg, jpeg, png, gif, ico, and some others

- Documents: pdf, doc, docx, ppt, pptx, pps, ppsx, odt, xls, xlsx

- Audio: mp3, m4a, ogg, wav

- Video: mp4, m4v, mov, wmv, avi, mpg, ogv, 3gp, 3g2

For an instance, any file that isn't within these catagories liability for infringement may provide the 'sorry you're not permitted to upload this file type.' error message.

Fixing the File Type Restriction Error

One of such methods as well as others is modifying the allowed file types and you can upload any file types that are not default in WordPress:

1.) Using a Plugin

There are numerous plugins on the WordPress repository which will assist you to control and tailor literally allowable file types. In this case, a PDF plugin might be the one of the most popular. When the plugin is installed and activated, you can then proceed to Settings > Upload File Types to enable or disable the types of files that you want uploaded.

2.) Modifying the Functions.php File

Such users can modify the WordPress file manually. Functions.php in order to include or remove file type restrictions.Here's how:

- Proceed to your WordPress access folder and look for a subfolder labelled "wp-content".

- Within your current theme's folder, navigate to "./wp-content/themes" folder to find your active theme.

- Find the “functions.php” file that is present in the ‘active theme’ folder and open its with a text editor.

- Append the below snippet to bottom of the file:

 * Allow additional file types to be uploaded

 */

function my_custom_upload_mimes( $existing_mimes = array() ) {

    // Add your custom file types here

    $existing_mimes['extension'] = 'mime/type';

    return $existing_mimes;

}

add_filter( 'upload_mimes', 'my_custom_upload_mimes' );

- Change the 'extension=' part to the file extension you wish to allow (e.g. svg) and the 'mime/type=' to the MIME type correspondingly (e.g image/svg+xml).

- In the next step, upload your file using the following code for the "functions.php" file:

- Modifying the wp-config.php File

For this method as well, adjust the wp-config.php file, which is the basic configuration file of wordpress.Follow these steps:

- Point your browser to WordPress installation directory and fetch “wp-config.php” file in there.

- This file has to be opened using any text editor.

- To put the capper on the file, insert the following line in the last:

 

define('ALLOW_UNFILTERED_UPLOADS', true);

Save it and then upload a number of times to improve its quality.

Note: Authorizing unfiltered content loads can give rise to security threats, for this reason it should be applied carefully to just a few formats of trustworthy files.

Additional Tips

- If you're still having trouble with specific file types, you can try deactivating and reactivating the theme or plugins you're using.

- Make sure you're using the latest version of WordPress, as newer versions may have updated file type restrictions.

- If you're uploading files through a plugin or a third-party service, check if they have their own file type restrictions.

- Always backup your website before making any changes to core WordPress files.

Conclusion

The "Sorry, you are not permitted to upload that file type" notice in WordPress is a common situation that usually resolves when modifying the allowed file types. It is not a must that you go for a plugin, make amendments on functions.php or enable Unfiltered uploads; but if you choose to any of these, make sure that you have covered all the steps correctly and considered the existing security implications. Based on that, you should manage the upload process of the right file types without problems.

Cut Hosting Costs! Submit Query Today!

Grow With Us

Let’s talk about the future, and make it happen!