Get 50% Discount Offer 26 Days

Recommended Services
Supported Scripts
WordPress
Hubspot
Joomla
Drupal
Wix
Shopify
Magento
Typeo3
File Type Is Not Permitted

One day, while working on my WordPress site, I encountered an error message that read, “Sorry, This File Type Is Not Permitted for Security Reasons.” It was frustrating because I needed to upload a file crucial for my site’s functionality. WordPress restricts certain file types by default to prevent potential security threats.

This error message indicates that the file type you’re trying to upload is not allowed. Understanding why WordPress imposes these restrictions can help you navigate the solutions effectively. 

If you’re working on a wordpress website an error message stating, “Sorry, This File Type Is Not Permitted for Security Reasons,” may appear. This can be frustrating, especially when attempting to upload a file essential for the site’s functionality. WordPress restricts certain file types by default to prevent potential security threats.

A self hosted wordpress is a savior in such situations, offering greater control and flexibility to address these issues. Understanding the reasons behind these restrictions can help navigate the solutions effectively.

Common Causes of the Error

The primary reason for this error is WordPress’s default file type restrictions. These restrictions are put in place to protect your site from potential security risks associated with certain file types. 

In my case, it was a simple SVG file that WordPress didn’t recognize as safe. Other contributing factors might include server configurations and specific security settings on your site, which may require you to fix the “sorry, you don’t see the file” error. 

Ensure these settings include permissions for uploading file types in WordPress.

1. Default WordPress File Type Restrictions

WordPress has built-in security measures that restrict certain file types to prevent potential threats. This can often result in the “Sorry, This File Type Is Not Permitted for Security Reasons” error when trying to upload less common or potentially unsafe files.

2. Security Settings

Security plugins or settings within your WordPress installation can further restrict the types of files that can be uploaded, contributing to the error.

3. Server Configurations

Server settings or configurations, such as those in your .htaccess file or MIME type settings, can also restrict certain file uploads. Misconfigurations or stringent security settings at the server level might cause this error.

4. MIME Type Mismatches

WordPress relies on MIME types to verify the nature of a file, which can be critical when you don’t see the file in your WordPress media library. If the MIME type doesn’t match the file extension, WordPress may block the upload to protect the site.

File Type Is Not Permitted, MIME Type Mismatches

5. File Size Restrictions

Large file sizes can sometimes be blocked by server settings or WordPress itself, causing the error even if the file type is usually permitted.

6. Outdated WordPress or Plugins

Using outdated versions of WordPress or its plugins might also result in this error due to compatibility issues or unpatched security restrictions.

How to Fix “Sorry, This File Type Is Not Permitted for Security Reasons” Error in WordPress | Solutions to Fix the Error

1. Modify the wp-config.php File

Modify the wp-config File

One of the quickest ways to bypass this restriction is to modify the wp-config.php file. This will help you upload any file type without limitations. By adding the following line of code, you can enable unfiltered uploads:

define(‘ALLOW_UNFILTERED_UPLOADS’, true);

I added this line to my wp-config.php file, which is located in the root directory of my WordPress installation. This allowed me to upload any file type I needed. After saving the changes, I was able to upload the file without any issues. 

However, this method poses significant security risks, as it allows any file type to be uploaded. Use this method with caution and consider other more secure options first. The “white screen of death” is a common WordPress error. This issue often occurs due to PHP errors, plugin conflicts, or exhausted memory limits. If you need further assistance with troubleshooting, you might also want to learn how to address the white screen of death error in WordPress.

2. Use a Plugin to Manage File Types

Several plugins can help manage and allow additional file types without compromising security. I found this method to be both secure and user-friendly.

WP Extra File Types Plugin

WP Extra File Types wordpress Plugin

This plugin allows you to add custom file types easily. Here’s how I did it:

  1. Install and Activate the Plugin: I searched for the WP Extra File Types plugin in the WordPress plugin repository and installed it.
  2. Configure the Plugin: After activation, I navigated to Settings > Extra File Types. Here, I could add the file types I wanted to allow, like SVG and ZIP files, and then save the changes.

This solution was secure and allowed me to manage file types through an easy-to-use interface.

File Manager Plugins

wordpress File Manager Plugins

File manager plugins provide a more comprehensive solution by allowing you to manage your site’s files directly from the WordPress dashboard. 

I used WP File Manager for this purpose. It provided a graphical interface for file management, making it easier to handle uploads and permissions without delving into server directories.

3. Update the Functions.php File

Another method to allow additional file types is by adding MIME types manually to your theme’s functions.php file.

Update the Functions php File

Here’s how I did it:

  1. Access the Functions.php File: I opened the theme’s functions.php file via the WordPress dashboard or an FTP client.
  2. Add the MIME Types: I added the following code snippet to allow SVG and ZIP files:
    function my_custom_mime_types($mimes) { $mimes[‘svg’] = ‘image/svg+xml’; $mimes[‘zip’] = ‘application/zip’; return $mimes; } add_filter(‘upload_mimes’, ‘my_custom_mime_types’);
  3. Save and Upload: After saving the changes, I could upload the previously restricted file types without any issues.

This method allows you to specify which MIME types should be permitted for uploads.

4. Adjust Server Settings

Modifying server settings can also resolve this issue. This involves making changes to your .htaccess file or server configuration files to allow specific MIME types.

MIME types to htaccess

.htaccess File Modifications

I added MIME types to my .htaccess file to permit uploads:

AddType application/zip .zip

AddType image/svg+xml .svg

This method ensures that the server recognizes and allows these file types.

Server MIME Type Configurations

For more advanced users, adjusting the server configuration (e.g., on Apache or Nginx) to include the necessary MIME types can resolve the issue. I edited the server configuration file to add the required MIME types, ensuring my server could handle the file formats I needed.

5. Utilize WordPress Multisite Configuration (if applicable)

If you’re using WordPress Multisite, you can enable specific file types across your network by adjusting the network settings.

  1. Access Network Settings: I went to My Sites > Network Admin > Settings.
  2. Modify Upload Settings: I scrolled down to Upload Settings and added the file extensions I wanted to allow across the network.

This method ensures consistency across all sites in the network. Each site can then upload any file type that is permitted.

Security Considerations

The improvement in performance and reliability has been impressive, especially after resolving below mentioned issues.

  • Regularly Audit Uploaded Files: I regularly check the files uploaded to my site to ensure no malicious files are present.
  • Keep WordPress and Plugins Updated: Ensuring my WordPress installation and plugins are up-to-date helps mitigate security vulnerabilities.
  • Implement Strong Security Measures: Using firewalls, malware scanners, and opting for DDoS protected hosting helps protect my site from potential threats. Additionally, checking permitted file types can enhance security.

These practices help maintain a balance between functionality and security.

Advanced Fixes

If the basic solutions don’t work, consider these advanced fixes:

Disable Antivirus/Firewall

Antivirus and firewall software can sometimes block certain file types. Temporarily disabling these can help identify if they are causing the issue.

  • Windows:
    1. Access Windows Security: I opened the Start menu and searched for “Windows Security.”
    2. Disable Firewall to resolve any issues related to file upload types.: I navigated to “Firewall & network protection,” selected my active network, and turned off the firewall. After this, I checked if the error persisted.
  • macOS:
    1. Access Security & Privacy in your WordPress admin.: I went to System Preferences > Security & Privacy.
    2. Disable Firewall: I selected the “Firewall” tab and turned off the firewall.

This helped me determine if my security software was interfering with the upload process.

Reset TCP/IP

Resetting the TCP/IP stack can resolve network configuration issues that might be causing the file upload error.

  • Windows:
    1. Open Command Prompt: I opened Command Prompt as an administrator.
    2. Reset TCP/IP: I entered netsh int ip reset and pressed Enter. After restarting my computer, the network configuration was reset.
  • macOS:
    1. Access Network Settings: I went to System Preferences > Network.
    2. Renew DHCP Lease: I selected my network, clicked “Advanced,” navigated to the TCP/IP tab, and clicked “Renew DHCP Lease.”

These steps helped refresh the network settings, resolving any underlying issues.

Check Hosts File

Check Hosts File

The hosts file can override DNS settings and cause issues if misconfigured. Make sure your server permits the right file types in WordPress to avoid conflicts.

  • Windows:
    1. Access Hosts File: I navigated to C:\Windows\System32\drivers\etc\hosts.
    2. Edit Hosts File: Using a text editor, I checked for any incorrect entries that might be causing the issue. Next, I tried to upload a file to WordPress to verify the fix.
  • macOS/Linux:
    1. Open Terminal: I opened Terminal and entered sudo nano /etc/hosts to edit your wp-config.php file.
    2. Edit Hosts File: I checked for incorrect entries and corrected them as needed. If you encounter further issues, you might want to learn how to fix the ERR_CONNECTION_REFUSED error.

Conclusion

The “Sorry, This File Type Is Not Permitted for Security Reasons” error in WordPress can be frustrating, but it is manageable with the right approach. By understanding the common causes and applying the appropriate fixes, you can successfully upload the necessary files without compromising your site’s security, such as when you need to fix the “sorry, you don’t see the file” error. Always prioritize secure methods and regularly audit your site’s security settings to prevent potential risks.

Leave a Reply

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

Lifetime Solutions:

VPS SSD:

Lifetime Dedicated Servers: