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.

Privacy Preference Center

Necessary

Necessary cookies help make a website usable by enabling basic functions like page navigation and access to secure areas of the website. The website cannot function properly without these cookies.

PHPSESSID - Preserves user session state across page requests.

gdpr[consent_types] - Used to store user consents.

gdpr[allowed_cookies] - Used to store user allowed cookies.

PHPSESSID, gdpr[consent_types], gdpr[allowed_cookies]
PHPSESSID
WHMCSpKDlPzh2chML

Statistics

Statistic cookies help website owners to understand how visitors interact with websites by collecting and reporting information anonymously.

_ga - Preserves user session state across page requests.

_gat - Used by Google Analytics to throttle request rate

_gid - Registers a unique ID that is used to generate statistical data on how you use the website.

smartlookCookie - Used to collect user device and location information of the site visitors to improve the websites User Experience.

_ga, _gat, _gid
_ga, _gat, _gid
smartlookCookie
_clck, _clsk, CLID, ANONCHK, MR, MUID, SM

Marketing

Marketing cookies are used to track visitors across websites. The intention is to display ads that are relevant and engaging for the individual user and thereby more valuable for publishers and third party advertisers.

IDE - Used by Google DoubleClick to register and report the website user's actions after viewing or clicking one of the advertiser's ads with the purpose of measuring the efficacy of an ad and to present targeted ads to the user.

test_cookie - Used to check if the user's browser supports cookies.

1P_JAR - Google cookie. These cookies are used to collect website statistics and track conversion rates.

NID - Registers a unique ID that identifies a returning user's device. The ID is used for serving ads that are most relevant to the user.

DV - Google ad personalisation

_reb2bgeo - The visitor's geographical location

_reb2bloaded - Whether or not the script loaded for the visitor

_reb2bref - The referring URL for the visit

_reb2bsessionID - The visitor's RB2B session ID

_reb2buid - The visitor's RB2B user ID

IDE, test_cookie, 1P_JAR, NID, DV, NID
IDE, test_cookie
1P_JAR, NID, DV
NID
hblid
_reb2bgeo, _reb2bloaded, _reb2bref, _reb2bsessionID, _reb2buid

Security

These are essential site cookies, used by the google reCAPTCHA. These cookies use an unique identifier to verify if a visitor is human or a bot.

SID, APISID, HSID, NID, PREF
SID, APISID, HSID, NID, PREF