Skip to main content
All CollectionsSupplementary GuidesWordPressGeneral
Solving Error “Sorry, this file type is not permitted for security reasons” in WordPress
Solving Error “Sorry, this file type is not permitted for security reasons” in WordPress
Rapyd Team avatar
Written by Rapyd Team
Updated over a year ago

Discover effective solutions to address the 'Sorry, this file type is not permitted for security reasons' error in WordPress and ensure smooth file uploads with enhanced security measures.

Understand What Solving Error “Sorry, this File Type is Not Permitted for Security Reasons”

The error message "Sorry, this file type is not permitted for security reasons" is a common issue encountered by WordPress users when they try to upload a file with a file type that is not allowed by the WordPress security settings. WordPress has built-in security measures to prevent certain file types from being uploaded to your website, as some file types can pose security risks if not handled properly.

The allowed file types for upload are defined in the WordPress configuration settings, specifically in the "wp-config.php" file or in the WordPress database. By default, WordPress allows common file types such as:

  1. Images: JPEG, JPG, PNG, GIF

  2. Documents: PDF, DOC, DOCX, PPT, PPTX, ODT, XLS, XLSX

  3. Audio: MP3, M4A, OGG, WAV

  4. Video: MP4, M4V, MOV, WMV, AVI, MPG, OGV, 3GP, 3G2

  5. Archives: ZIP, RAR, 7z

When you receive the error message, it means that the file you are trying to upload has a file type that is not included in the list of allowed file types. This restriction helps protect your website from potential security vulnerabilities that may arise from malicious files.

Solving The Error Message in Different Ways

There are a few methods to solve the issue and permit additional file types to be uploaded. Below, we walk you through these methods.

Expand Allowed File Types Using WordPress Plugins

To solve the "file type not permitted" error, you can install and activate plugins like WP Extra File Types by following these steps: Log in to your WordPress Dashboard, navigate to Plugins > Add New, search for the plugin, Install it, and then Activate it.


Next, hover over Settings and select Extra File Types.

To select your desired file types, browse through the extensive list and place a checkmark next to the extensions you want.

If you don't find your desired extension in the list, you can add it manually in the "Add your custom file types" section. Remember to click the Save Changes button after making any modifications.

Once you have completed all the necessary steps, attempt to upload your desired file to ensure that everything is functioning correctly.

Modifying Theme's functions.php File

First, Open WordPress Admin Panel then go to Appearance > Theme File Editor

Choose your current theme from Select the to edit drop-down menu. Then click on the function.php file.

Now add this code in the function.php file and press the Update File button.

function my_custom_mime_types( $mimes ) {
// Add Your Desired MIME types here
$mimes['svg'] = 'image/svg+xml';
$mimes['svgz'] = 'image/svg+xml';
$mimes['doc'] = 'application/msword';
$mimes['gpx'] = 'text/gpsxml';
return $mimes;
}
add_filter( 'upload_mimes', 'my_custom_mime_types' );

Now try to upload files with the MIME you included in the php file.

Adjusting wp-config.php File

First, access your WordPress website files through a file manager in your hosting control panel, FTP (File Transfer Protocol) using an FTP client like FileZilla or Plugin like WP File Manager.

Navigate to the root directory of your WordPress installation and locate the wp-config.php file. Open the file in a Code Editor.

Next, insert the following code anywhere in the file before the line that says "/* That's all, stop editing. Happy blogging. */":

define('ALLOW_UNFILTERED_UPLOADS', true);

Make sure to click the Save button before exiting the wp-config.php file.

Finally, try uploading a file with a previously restricted file type to verify if the changes have taken effect. If the file is now allowed for upload, it means that you have successfully adjusted the wp-config.php file to modify the allowed file types.

Conclusion

Encountering the "Sorry, file type not permitted" error in WordPress can be frustrating, but solutions exist. Adjusting WordPress settings, using plugins, or modifying wp-config.php or function.php files are different types of options. Implementing these solutions enhances file upload flexibility while maintaining security. Proceed with caution, make backups, and update regularly for a secure website.

Did this answer your question?