Sorry You are not Allowed to Upload this File Type

Last updated December 6th, 2023 00:18

Are you using the WordPress content management system on your website? You probably know that for enhanced security reasons, it only allows uploading certain file types. These typically include files commonly used in computer work, such as images, documents, or videos. Unfortunately, any other less typical file formats are prohibited by default in WordPress and need to be manually enabled. If you have ever encountered the error message “Sorry You are not Allowed to Upload this File Type,” you are in the right place. Let’s take a look at how to handle it.

Sorry You are not Allowed to Upload this File Type

If you were to attempt adding any file format other than the allowed ones, WordPress would return this error message to you.

Sorry You are not Allowed to Upload this File Type

Therefore, let’s now demonstrate the procedure of allowing other file extensions for upload using the function.php file.

Editing the function.php file

Enabling file upload is done by modifying the function.php script, which is accessible through the editor of your theme. Since you will be directly modifying the source code of the theme template, it is strongly recommended to create a backup of the template itself or, at the very least, the entire code of the function.php script before proceeding with this step.

To modify the function.php script, follow these steps:

  • Log in to your WordPress administration panel
  • In the left-hand menu, click on “Appearance
  • Then, in the submenu, navigate to “Theme Editor
  • In the right-hand menu, select “function.php” from the list of template files.
  • Insert the code provided below at the end of the script in the editor
  • Click on “Update File” to save the changes.
Jak můžu ve WordPressu nahrát nepovolený typ souboru?

The code that you need to insert into the function.php file is as follows:

					function my_myme_types($mime_types){
 $mime_types['svg'] = 'image/svg+xml'; //Povolí .svg
 return $mime_types; 
add_filter('upload_mimes', 'my_myme_types', 1, 1);

The line that will be of most interest to us is:

					$mime_types['svg'] = 'image/svg+xml'; //Povolí .svg

In this line, you are defining the file extension. In our case, it is the .svg file, and you are also specifying its MIME type within the line.

In the [‘svg’] part of the code, you will insert the exact file extension of the file you want to allow for upload. Furthermore, after the equals sign, you need to insert the precise MIME type of the file. In our case, it is ‘image/svg+xml’.

If you don’t know the MIME type of your file, you can find it on a page like this:

How can I insert code to allow multiple files at once?

The principle is exactly the same as in the above case. You only insert each additional file on a new line. Let’s see an example:

					function my_myme_types($mime_types){
 $mime_types['svg'] = 'image/svg+xml'; // povolí .svg
 $mime_types['psd'] = 'image/vnd.adobe.photoshop'; // povolí .psd
 $mime_types['.abw'] = 'application/x-abiword'; // povolí .abw
 return $mime_types; 
add_filter('upload_mimes', 'my_myme_types', 1, 1);

As you can see, the code has changed only in that instead of one line with the allowed SVG file, we now have three lines. We have allowed not only the .svg file but also the .psd and .abw files.

Sorry You are not Allowed to Upload this File Type


In conclusion, it should be noted that WordPress does not have other files banned by default. Always consider carefully whether to allow additional file types or not. If it was meant to be a one-time file upload to the website, it might be better to upload such a file using FTP and not allow other file types in WordPress. After all, it partly concerns the security of the entire system. Keep this in mind at all times.

More content about WordPress

Whole category is here

The website is created with care for the included information. I strive to provide high-quality and useful content that helps or inspires others. If you are satisfied with my work and would like to support me, you can do so through simple options.

Byl pro Vás tento článek užitečný?

Klikni na počet hvězd pro hlasování.

Průměrné hodnocení. 0 / 5. Počet hlasování: 0

Zatím nehodnoceno! Buďte první

Jak užitečný vidíte tento článek.

Sledujte mě na sociálních médiích.

Je mi líto, že pro Vás nebyl článek užitečný.

Jak mohu vylepšit článek?

Řekněte mi, jak jej mohu zlepšit.


Subscribe to the Newsletter

Stay informed! Join our newsletter subscription and be the first to receive the latest information directly to your email inbox. Follow updates, exclusive events, and inspiring content, all delivered straight to your email.

Upozornit na
0 Komentáře/ů
Vložené zpětné vazby.
Zobrazit všechny komentáře.

Pokud mi chcete napsat rychlou zprávu, využije, prosím, níže uvedený
kontaktní formulář. Děkuji.

Další Kontaktní údaje