Categories
WordPress

Fix error WordPress “Sorry, This File Type Is Not Permitted For Security Reasons”

Method 1: WordPress Plugin

Use any of the following WordPress plugins add additional mime type and allow the file type to upload as well:

  • WP Add Mime Types
  • Mime Types Extended
  • Unsafe Mime types
  • Mime Types Plus

Method 2: Allow all file type

Update wp-config.php. This file will be found in root directory of WordPress installation.

Open the file with ftp edit/vi editor/ vim editor or nano editor, and save the file after editing it.

If the following line is already present it the wp-config.php file change its value from “false” to “true”.

define(‘ALLOW_UNFILTERED_UPLOADS’, true);

Method 3: Allow specific file type

Add the following code into wp-contents/themes/current-theme/functions.php

function enable_extended_upload ( $mime_types =array() ) {

    // The MIME types listed here will be allowed in the media library.

    // You can add as many MIME types as you want.

    $mime_types[‘gz’]  = ‘application/x-gzip’;

    $mime_types[‘zip’]  = ‘application/zip’;

    $mime_types[‘rtf’] = ‘application/rtf’;

    $mime_types[‘ppt’] = ‘application/mspowerpoint’;

    $mime_types[‘ps’] = ‘application/postscript’;

    $mime_types[‘flv’] = ‘video/x-flv’;

    // If you want to forbid specific file types which are otherwise allowed,

    // specify them here.  You can add as many as possible.

    unset( $mime_types[‘exe’] );

    unset( $mime_types[‘bin’] );

    return $mime_types;

    }

    add_filter(‘upload_mimes’, ‘enable_extended_upload’);

Method 4: Multisite Setting

This can only be used if multisite is enabled in WordPress.

Network Admin Area -> Settings -> Upload Settings -> add file type into it

Different file types should be separated with space.

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.