Bobcares

“Sorry this file type is not permitted for security reasons” in WordPress

by | Apr 25, 2021

The error, “Sorry this file type is not permitted for security reasons” in WordPress occurs when we try to upload a document to the WordPress library.

As part of our Server Management Services, we assist our customers with several WordPress queries.

Today, let us see how we can fix this error.

 

“Sorry this file type is not permitted for security reasons”

In order to stop people from putting potentially malicious executable files on their site, WordPress only accepts uploads of certain file types.

If there is any file type that it does not accept, we receive the error.

“Sorry this file type is not permitted for security reasons” in WordPress

However, there are certain types of files (i.e. MIME types) that WordPress will accept.

Also known as Media types, MIME stands for Multipurpose Internet Mail Extensions. They consist of a two-part naming convention which first specifies the file type followed by the subtype.

For example, text/html and image/png each represent a specific MIME type.

According to the WordPress Codex, the file types that we are able to upload include:

  • Images
.jpg
.jpeg
.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

Alternatively, we may see a different message:

”[filename] has failed to upload” or “the media you tried to upload was invalid”.

For example, if we try to upload a .tff or .woff file, these will not upload.

 

How to solve this error?

Moving ahead, let us see how our Support Techs go about fixing this error.

Change the WordPress Multisite Settings

WordPress Multisite lets us make multiple websites. They join by a network and can change all at once.

For example, suppose we have a chain of stores and want a site for each location. Updating them simultaneously will save a lot of time.

In addition, WordPress Multisite lets to upload files we cannot usually upload.

To do so, go to:

  • Network Administration Area
  • Settings
  • Upload Settings

If we add multiple types, we put a space between with no comma.

Install a plugin that enables extra MIME types

A quick and easy solution to this error is to install a MIME plugin that allows us to upload not permitted file types.

A few plugins that will do the trick includes:

  • WP AddMime Types
  • Mime Types Plus
  • Unsafe Mime Types
  • Pro Mime Types
  • Mime Types Extended

Edit wp-config.php file to allow unfiltered uploads

ALLOW_UNFILTERED_UPLOADS is a function we can activate in WordPress. We can activate it in our site’s wp-config.php file. Then in the Media Library, we will be able to upload any kind of file.

  • Firstly, keep a backup copy of the site.
  • Open the wp-config.php file.
  • Then we add the below code:
    define(‘ALLOW_UNFILTERED_UPLOADS’, true);
  • We can add it anywhere before:
    – /* That’s all, stop editing! Happy blogging. */

This will prevent all file-type upload checks from taking place, leaving the website vulnerable to potentially malicious uploads.

Change the functions.php file of our theme

A simple resolution is changing the theme’s functions.php to allow custom MIME types. We can change which file types WordPress accepts by utilizing the upload_mimes filter.

  • Using a file manager or FTP client, find the installation directory for WordPress (often public_html).
  • Then we go to wp-content >> themes.
  • We find the folder of the theme we are using.
  • Find and access the functions.php file.
  • Then we add the following:
    function my_custom_mime_types( $mimes ) {
    // Add new MIME types here
    $mimes[‘abiword’] = ‘application/x-abiword’;
    return $mimes;
    }
    add_filter( ‘upload_mimes’, ‘my_custom_mime_types’ );
  • Eventually, we save the changes.

While we remove or add any MIME types necessary, remember to add the extensions associated with them.

Get in touch with the hosting provider

It is also possible that the hosting providers sometimes limit the upload of file types for security reasons.

In such a case, they will be able to help.

[Couldn’t resolve the error? We’d be happy to assist]

 

Conclusion

To conclude, “Sorry this file type is not permitted for security reasons” in WordPress occurs when we try to upload a document to the WordPress library.

PREVENT YOUR SERVER FROM CRASHING!

Never again lose customers to poor server speed! Let us help you.

Our server experts will monitor & maintain your server 24/7 so that it remains lightning fast and secure.

GET STARTED

var google_conversion_label = "owonCMyG5nEQ0aD71QM";

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

Never again lose customers to poor
server speed! Let us help you.