FIX: WordPress “file type is not permitted for security reasons”

2 minutes read

WordPress allows its users to upload and use a variety of files with different formats. But while uploading files with format other than image files, it reflects this annoying error warning most of the times:

Sorry, this file type is not permitted for security reasons.

Below is the screen capture of the error produced in the real time when I tried uploading a *.swf file to my WordPress media library:

File type not permitted: WordPress Error
This is how the error occurs (in red) when uploading the file [Click image to see the bigger version]

WordPress Multisite provides a way to fix it up from the Upload settings, but a generic WordPress installation doesn’t have any such options to get rid of this error.

Fixing the Error

Note that clicking on “Dismiss Error” and uploading again is not going to fix it at all. Here is the real and tested 2-step fix that should solve the problem:

  1. Copy and paste the below line of code in the wpconfig.php file of your WordPress installation:
    define('ALLOW_UNFILTERED_UPLOADS', true);

    Now go back to media library and try uploading the media that showed the error earlier before. If it gets uploaded successfully, you won’t need anything else. But else, continue to the next step.

  2. Add the below give code to the functions.php file of your WordPress theme and save the changes:
    add_filter('upload_mimes', 'pixert_upload_types');
    function pixert_upload_types($existing_mimes=array()){
     $existing_mimes['mp4'] = 'video/x-mp4';
     $existing_mimes['swf'] = 'video/x-swf';
     $existing_mimes['flv'] = 'video/x-flv';
     $existing_mimes['mid'] = 'audio/midi';
     return $existing_mimes;

    [*] You may add more mime types for different file formats in the above code as per your need.

Now again, retry uploading that file. The error should get fixed by now.

If you’re still seeing an error, leave a comment below. I’ll be happy to help you with that. Thanks.

Facebook Twitter LinkedIn Telegram Whatsapp Pocket

Related Posts:

Cyber security is not an entry-level field, which means that there are a few fundamental skills and knowledge you must be familiar with before diving into it. It would help if you had some mastery of technical and non-technical skills to excel in this field. T...
To mount WordPress files into an existing directory, you can follow these steps:Download WordPress: Visit the official WordPress website ( and download the latest version of WordPress. Extract WordPress files: Extract the downloaded
Jetpack is a popular WordPress plugin developed by Automattic, the same company behind It offers various features and tools to enhance the functionality and performance of a WordPress website. However, there might be instances where you want to ...