The error message “Sorry, This file type is not permitted for security reasons” typically appears when uploading a file to your website, whether an image, document, or other type.
This message belongs to a security feature implemented by your content management system (CMS) or web server to prevent potentially harmful files from being uploaded.
- File type security ensures that only authorized files can be uploaded and downloaded from a website.
- It plays a pivotal role in safeguarding sensitive information and preventing malicious attacks.
- Website owners can bolster their defenses against potential threats by comprehending the importance of file type security.
Contents
Common Reasons for the Error
Before we dive into the solutions, let’s explore the common reasons:
- File Format Compatibility – One of the primary reasons for this error is the file format. Some platforms or systems restrict certain file types for security reasons.
- Security Policies—System security policies may block files that are not recognized as safe. This is done to protect your device from potential threats.
- Outdated Software – Using outdated software or apps may lead to compatibility issues, triggering the error message.
- File Size Limitations—Some platforms restrict file sizes. If you exceed these limits, you might encounter an error.
- Server Restrictions – Server configurations and settings can prevent you from uploading or accessing certain file types.
NOTE: It’s a good idea to back up your website completely. This way, you can easily restore it if something goes wrong. You can use WP Staging, which makes automatic backups with just a few clicks.
Fixing “Sorry, This File Type Is Not Permitted for Security Reasons”
Now that we understand the potential causes, let’s explore practical solutions to fix this error:
METHOD 1: Unlock Additional MIME Types via functions.php
If you have some coding skills and want to grant permission for additional MIME types, you can adjust your active theme’s functions.php file. This method allows you to specify the file types you wish to permit.
To unlock additional MIMI Types, use a custom function in the theme’s “functions.php” file. Here’s how:
Locate your WordPress theme’s functions.php file.
2. Insert the following code snippet at the end of the file:
function allow_custom_mime_types( $mimes ) {
$mimes['custom-type'] = 'application/octet-stream'; // Add your desired MIME type here
return $mimes;
}
add_filter( 'upload_mimes', 'allow_custom_mime_types' );
Replace 'custom-type'
with the desired file extension and 'application/octet-stream'
with the corresponding MIME type.
Save Your Changes – After adding the code, click the “Save Changes” button to save your modifications.
METHOD 2: Enable Unrestricted Uploads through wp-config.php
If you want to grant unrestricted upload access for all file types on your WordPress site, you can achieve this by adding a specific line of code to your site’s wp-config.php file.
However, it’s crucial to exercise caution when using this method, as it allows all file types to be uploaded by administrator-level users. It’s generally considered best practice to add file types as needed.
You can edit the wp-config.php file in your WordPress installation to enable unrestricted uploads. Here’s how:
- Locate the “wp-config.php” in the root folder of your WordPress installation. Open the file in a text editor.
Add the following code snippet above the mentioned line:
define('ALLOW_UNFILTERED_UPLOADS', true);
This code will override restrictions on file uploads for administrator-level users.
Save Your Changes- After adding the code, save the wp-config.php file, overwriting the existing file.
METHOD 3: Authorizing Additional MIME Types with a Plugin
To simplify the process of permitting additional MIME types for file uploads, you can use a trusted plugin like “WP Extra File Types.” This plugin streamlines the setup, making it user-friendly and efficient.
Customizing File Types for Upload
If the file type you intend to upload isn’t listed, you can include your custom file types at the end of the plugin’s settings list. This customization feature offers flexibility and caters to your needs, ensuring you can work with the file formats that matter most to you.
METHOD 4: Adjusting WordPress Multisite Configuration
WordPress Multisite is a powerful tool allowing users to oversee multiple websites using a centralized dashboard. Beyond this, it also boasts a feature that allows you to customize the file types permitted for upload. Here’s how to go about it:
Begin by logging in to your WordPress admin area. In the top menu, select “Network Admin,” and then go to “Settings” followed by “Network Settings”. Scroll down until you reach the “Upload Settings” section. In the field provided next to “Upload file types,” enter the file extensions of the formats you wish to allow for upload. Be sure to save your modifications.
Allowed Image File Types
Images play a significant role in web content. To ensure a smooth user experience and security, the following image file types are typically permitted:
- .jpg and .jpeg (Joint Photographic Experts Group): These formats are widely used for photos and graphics due to their excellent compression capabilities and quality.
- .png (Portable Network Graphics): PNG files are preferred when image transparency is essential. They offer high-quality visuals with lossless compression.
- .gif (Graphics Interchange Format): GIFs are ideal for animations and simple graphics, making them popular for web designers.
- .ico (Icon file): ICO files are commonly used for website favicons and small icons.
Allowed Document File Types
Documents are fundamental for sharing information. The following document file types are typically allowed:
- .pdf (Portable Document Format): PDF files created by Adobe Acrobat are known for maintaining formatting consistency across different devices and platforms.
- .doc and .docx (Microsoft Word Document): These formats are widely used for word processing and document creation.
- .ppt, .pptx, .pps, .ppsx (Microsoft PowerPoint Presentation): These formats are used for creating and delivering presentations.
- .odt (OpenDocument Text Document): ODT files are open standards for text documents, offering compatibility with various word processing software.
- .xls and .xlsx (Microsoft Excel Document): Excel files are famous for creating and managing spreadsheets and data.
- .psd (Adobe Photoshop Document): PSD files are associated with Adobe Photoshop and are used for editing and storing image data.
Allowed Audio File Types
Audio files are essential for multimedia content. These formats are usually allowed:
- .mp3: MP3 files are a standard for audio compression, offering a good balance between sound quality and file size.
- .m4a: M4A files are associated with Apple’s iTunes and are known for high audio quality.
- .ogg: OGG files are open-source audio formats that provide a royalty-free alternative to proprietary codecs.
- .wav: WAV files are known for their lossless audio quality and are often used for high-fidelity audio recordings.
Allowed Video File Types
Video content is a powerful medium for engaging your audience. The following video file types are typically permitted:
- .mp4 and .m4v (MPEG-4): These widely supported formats provide high-quality video with efficient compression.
- .mov (QuickTime): MOV files are created by Apple’s QuickTime software and are known for their quality.
- .wmv (Windows Media Video): WMV files are suitable for Windows users and offer good compression with high quality.
- .avi: AVI files are a popular multimedia container format that supports various video and audio codecs.
- .mpg: MPG files are commonly used for storing video and audio data and are compatible with many media players.
- .ogv (Ogg): OGV files are open-source video formats that provide a free and open alternative to proprietary video codecs.
- .3gp and .3g2 (3GPP and 3GPP2): These formats are commonly used for mobile video, offering efficient compression for small-screen devices.
By following this guide, you can effortlessly tailor your WordPress Multisite to accommodate the specific file types you need, ensuring a seamless and customized experience for your network of websites.
Related Articles
- How to Fix the “Failed to Load Resource” Error in WordPress?
- How to Fix the 504 Gateway Timeout Error in WordPress?
- How to Remove Query Strings from Static Resources in WordPress
- How to Fix the Error “Establishing a Database Connection” in WordPress
- How to Troubleshoot the 503 Service Unavailable Error in WordPress