Then, you simply tried to upload a file to your WordPress website and, instead of successfully uploading, you received an error bulletin that said, "Sorry, this file type is not permitted for security reasons."

Your first instinct might be to panic. Did you just almost upload a corrupted file to your site? Was it malware? Is your site compromised now?

Don't worry — while this message might seem ominous, it only ways that WordPress does non support the file blazon y'all tried to upload. In this post, we'll examine what causes this mistake bulletin and wait at a few free and easy means to resolve it.

Grow Your Business With HubSpot's Tools for WordPress Websites

For example, let's say I try to upload an AVIF file to WordPress. AVIF is an paradigm format that stores compressed images. Although this format promises to exist a game-changer in epitome compression, it's still relatively new and therefore not a pop file format.

WordPress does non support this file type. If I try to upload an AVIF file, I'll receive the "deplorable, this file type is not permitted for security reasons" fault. Hither'south how that error looks in the Gutenberg editor:

If you but upload file types that WordPress supports, you lot probably won't e'er see this fault message. Side by side, permit'south review what those file types are.

WordPress Allowed File Types

WordPress supports a broad range of file types including the most common images, video, certificate, and audio formats. These file types are likewise known as Multipurpose Internet Mail Extensions, or MIME types. MIME types help browsers figure out what type of content has been uploaded to a web folio.

If you upload a .jpeg file and .png file, for case, the browser uses their MIME types to determine that these are both image files. Similarly, if you upload a .mp3 or a .wav file, the MIME type signals to the browser that these are audio files.

WordPress supports uploading the post-obit file types:

Images

  • .jpg
  • .jpeg
  • .png
  • .gif
  • .ico

Document

  • .pdf
  • .medico, .docx
  • .ppt, .pptx, .pps, .ppsx
  • .odt
  • .xls, .xlsx
  • .psd

Audio

  • .mp3
  • .m4a
  • .ogg
  • .wav

Video

  • .mp4, .m4v
  • .mov
  • .wmv
  • .avi
  • .mpg
  • .ogv
  • .3gp
  • .3g2

Note that you can upload HTML files to WordPress in improver to the files listed above. Likewise, nosotros don't recommend uploading videos directly to your WordPress media library, since they use upwards significant storage and can slow down your website. Instead, opt for a video hosting service to store your videos.

These file types are all quite common. However, you lot may want to upload a file type that's not on this list. Or, you may be trying to upload one of these permitted file types and still go the "sorry, this file type is not permitted for security reasons" error message.

In either case, there are steps you lot tin take to avoid this error message.

1. Check your file blazon extension.

Earlier you lot starting time irresolute your WordPress settings or files, cheque the extension of the file yous're trying to upload. Maybe you accidentally changed the extension when saving the file. So, the reason you're seeing the mistake message is not a problem with your wp-config.php or functions.php file — it'due south that you lot're trying to upload an prototype in a video format.

In the example below, I tried to upload a .jpg file equally an .avi file and got the error bulletin equally a result.

Incorrect file name extension causing the "

This is an easy first step: If the file name extension is incorrect, then you lot can set up information technology and upload the file in the correct format. If it is correct, move on to the next step.

two. Change your multisite network settings.

If you are running a multisite installation — a network of sites that all share the same WordPress installation cadre files — then you tin easily add more immune file types.

To add a file blazon, click Settings > Network Settings in your dashboard, then curl down to Upload Settings. In the input field side by side to Upload file types, add together the extension for the file type you want to upload. And then, salvage your changes.

Adding allowed file types in upload settings of WordPress multisite installation

Users on any site in your network volition now be permitted to upload all the file types listed here.

If you are running a single-site WordPress installation, you won't accept this option in your settings. You'll demand to try i of the steps below.

3. Edit your wp-config.php file to upload any file type.

If you want to permit any and all file types to exist uploaded to your site, you lot merely need to add together one line of code to your wp-config.php file.

It's relatively simple to do this, only as a best practise, you should always brand a fill-in of your wp-config.php file before editing. Even a pocket-size error in the file can make your site inaccessible.

In one case you've fabricated a copy of your wp-config.php file, follow the steps below to permit any file type upload.

  • Admission File Manager via your hosting control panel.
  • Open your public_html folder.
  • Locate and right-click the wp-config.php file, then choose Edit.
  • Coil to the lesser of the file.
  • At the cease of the file, you'll see the line: /* That's all, stop editing! Happy blogging. */. Above this line, paste the post-obit code:
                                          

define('ALLOW_UNFILTERED_UPLOADS', true);

  • Relieve your changes to the file.
  • Log out of WordPress, and then sign back in. Y'all should now be allowed to upload whatsoever file blazon.
  • Save your changes. Y'all should now exist allowed to upload the new file types.

This is a relatively easy solution, but not ideal for every website. If multiple users are uploading files on your WordPress site, for example, you may want to specify which file types are permitted. In that case, continue reading.

4. Edit your theme's functions.php file to modify permitted file types.

If you lot want to allow merely certain file types to be uploaded to your site, y'all tin utilise the Upload_Mimes Filter. Here's how:

  • Access File Manager via your hosting control panel.
  • Open your wp-content folder.
  • Open your themes binder.
  • Locate and right-click the functions.php file, then cull Edit.
  • Scroll to the bottom of the file and paste the following lawmaking:
                                          

function cc_mime_types($mimes) {

    // New immune mime types.

  $mimes['svg'] = 'prototype/svg+xml';

  $mimes['svgz'] = 'prototype/svg+xml';

  return $mimes;

}

add_filter( 'upload_mimes', 'my_custom_mime_types' );

Note that the code above allows SVG and SVGZ files. You tin can change or add together MIME types to this lawmaking snippet depending on what file types yous desire to upload.

While advanced users won't have a problem adding code to their functions.php or wp-config.php files, beginners might. In that instance, you lot can use a WordPress plugin too.

5. Install a plugin to add more permitted file types.

If y'all'd prefer not to edit your wp-config.php or functions.php files directly, then you tin use a plugin to add permitted file types on your website.

WP Add Mime Types and File Upload Types by WPForms are two such plugins. While both are free from the official WordPress directory and highly rated, the File Upload Types plugin is more beginner-friendly. Follow these steps to use information technology:

  • Install and actuate the File Upload Types by WPForms plugin.
  • Under Settings, click File Upload Types.
  • Check the boxes next to the file types you lot want to upload. The list is pretty long, but you lot tin search for your extension using the search bar in the peak correct. If your extension isn't on the listing, you tin add your ain custom file type at the lesser.
  • When finished, click Save Settings. You should now be immune to upload the new file types.

Adding more permitted file types using File Upload Types by WPForms plugin

6. Contact your hosting provider.

If you lot've tried all the steps above and are still getting an error message, then contact your WordPress hosting provider back up squad and depict your issue.

Information technology's possible that your provider has stricter limits on the file types yous can upload than WordPress has by default. In that case, the steps above won't resolve the "sorry, this file type is non permitted for security reasons" mistake, but your provider's customer back up likely can.

Securing Your File Uploads

Even though in that location are ways to get around the "lamentable, this file type is non permitted for security reasons" fault, that doesn't hateful y'all should ignore the security issues that WordPress sites can experience. WordPress restricts the file types you can upload considering allowing any file type would arrive easier for bots and hackers to identify malware on your site.

That's why nosotros recommend specifying which file types you lot desire to allow as to non open your website to any type of file, and consider preventing users with lower roles from uploading files to your site.

Additionally, only upload plugin and theme files downloaded from legitimate sources, as these files are some of the most mutual causes of compromised WordPress sites. And, behave regular malware scans for harmful code that may have found its manner in via an upload.

For more ways to protect your site from hacking attempts, see our total guide to WordPress security.

Uploading File Types in WordPress

A "deplorable, this file type is not permitted for security reasons" error can be frustrating for site admins and users. The good news is that the steps above can either resolve the error or permit you to control which file types yous're able to upload — without compromising the security of your WordPress site.

Editor's note: This post was originally published in January 2021 and has been updated for comprehensiveness.

Use HubSpot tools on your WordPress website and connect the two platforms  without dealing with code. Click here to learn more.

Use HubSpot tools on your WordPress website and connect the two platforms  without dealing with code. Click here to learn more.

Originally published Oct five, 2021 7:00:00 AM, updated October 05 2021