When you try to upload a file through the WordPress admin dashboard, you might see the error “Sorry, this file type is not allowed for security reasons.” WordPress restricts uploads to specific file types to block potentially dangerous executable files. Only certain file types are permitted by default, and uploading others causes this error.
Default Allowed File Types
- Images: .jpg, .jpeg, .png, .gif
- Documents: .pdf (Adobe Acrobat), .doc, .docx (Microsoft Word), .ppt, .pptx, .pps, .ppsx (Microsoft PowerPoint), .odt (OpenDocument Text), .xls, .xlsx (Microsoft Excel)
- Audio: .mp3, .m4a, .ogg, .wav, .midi, .mid, .wma
- Video: .mp4, .m4v (MPEG-4), .mov (QuickTime), .wmv (Windows Media Video), .avi, .mpg, .ogv (Ogg), .3gp (3GPP), .3g2 (3GPP2), .webm
- Others: .zip, .key
Ways to Fix the Issue
Here are different methods to address this error:
1. WordPress Multisite Settings
If you’re using WordPress Multisite, you can add allowed file types easily:
- Navigate to Network Admin > Settings > Upload Settings.
- Add the desired file types in the “Upload file types” field, using spaces to separate them (not commas).
- Save your changes.
2. Troubleshoot Plugin Issues
A plugin might be causing the restriction. To check:
- Deactivate all plugins and try uploading the file again.
- If it works, reactivate plugins one at a time to find the one causing the issue.
- Once identified, replace or adjust the problematic plugin.
3. Install a Plugin to Allow More File Types
Use one of these plugins to enable additional file types:
- WP Add Mime Types
- Mime Types Extended
- Unsafe Mime Types
- Mime Types Plus Configure the plugin to allow your desired file types.
4. Enable All File Types
To allow all file types (use with caution due to security risks):
- Access the wp-config.php file in your WordPress root directory using a text editor or cPanel File Manager.
- Add this line: define('ALLOW_UNFILTERED_UPLOADS', true);
- Save the file.
5. Allow Specific File Types
To permit only certain file types, edit your theme’s functions.php file, located at /wp-content/themes/your-theme/functions.php:
- Add this code using a text editor or File Manager:
php
function allow_custom_uploads($mime_types = []) { // Add permitted MIME types $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'; // Remove unwanted MIME types unset($mime_types['exe']); unset($mime_types['bin']); return $mime_types; } add_filter('upload_mimes', 'allow_custom_uploads'); - Modify the code to include only the file types you want.
- Save the changes.
Notes
- Always back up your site before editing wp-config.php or functions.php.
- Be careful when allowing uncommon file types, as they could introduce security risks.
- If the problem continues, reach out to support@gptservers.net for help.
Hope this clears things up!