Or copy link
Copy link
The “Sorry, you are not allowed to upload this file type” error in WordPress often arises when you attempt to upload a file format that is not permitted by your website’s configuration. This can be due to security reasons performance considerations or specific site requirements
In this article, we will explore various methods to resolve WordPress upload file type error issue and allow you to successfully upload the desired file type.
Before getting into solutions it is important to understand why WordPress file upload issue error occurs:
The following are troubleshooting steps to fix WordPress file upload error:
While the functions.php file primarily controls your theme’s functionality, you can also use it to modify certain WordPress settings including file upload restrictions. Navigate to the “Appearance” section in your WordPress dashboard. Click on the “Theme File Editor” option.
functions.php
Add a custom allowed file types WordPress filter with the following code:
function my_allowed_file_types($mimes) { $mimes['pdf'] = 'application/pdf'; $mimes['docx'] = 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'; return $mimes; } add_filter('upload_mimes', 'my_allowed_file_types');
Click Update File at the bottom of the dashboard.
If you have access to your website’s files via FTP or file manager which is in my case cPanel, navigate to the “public_html” directory of your WordPress installation. Look for the .htaccess file.
It may be hidden you need to check box the “Show Hidden Files” option from the “Settings” section.
Once you have access to the .htaccess file you can add or modify WordPress file upload restrictions using specific directives. Here are some common examples:
Deny File Types
Edit the following lines in your .htaccess file:
<FilesMatch "\.(exe|php|phtml)$"> Deny from all </FilesMatch>
This code denies access to files with the .exe .php and .phtml extensions. You can modify the extensions to match your desired restrictions.
Allow File Types
<FilesMatch "\.(jpg|jpeg|png|gif)$"> Allow from all </FilesMatch>
This code allows access to files with the .jpg .jpeg .png and .gif extensions. You can adjust the extensions to match the file types you want to permit.
Deactivate all plugins temporarily. Try saving your content again. If the error disappears a plugin is the issue. To identify the problematic plugins, reactivate them one by one and test them after each activation to pinpoint the conflicting ones. To perform deactivation navigate to the “Plugins” section in your WordPress dashboard. Deactivate all plugins from “Bulk Actions”.
Similar to plugins your theme might be causing the issue. Switch to a default WordPress theme like Twenty Twenty-Four. If the error disappears you have identified a theme-related problem. You can then try updating your theme to the latest version or explore alternative themes that are compatible. To do this, log into the WordPress dashboard and navigate to the “Appearance” section then the “Themes” option.
While WordPress provides options to control file type restrictions on the client side, server-side configuration can also play a significant role. For Apache configuration modify the httpd.conf file to add or modify MIME types for specific file extensions. This ensures the server correctly recognizes and handles the uploaded files.
httpd.conf
AddType application/pdf pdf AddType application/msword doc AddType application/vnd.openxmlformats-officedocument.wordprocessingml.document docx
Similarly, for NGINX configuration edit the nginx.conf file to define MIME types for different file extensions.
nginx.conf
types { types { pdf application/pdf; doc application/msword; docx application/vnd.openxmlformats-officedocument.wordprocessingml.document; } }
Unlock the power of Fast WordPress Hosting
Increase the speed of your website with Ultahost’s WordPress hosting and provide your visitors with the best possible faster page-loading experience.
If you frequently encounter the “Sorry, you are not allowed to upload this file type” error and need to support a wide range of file formats exploring plugins can be a valuable solution. These plugins often extend WordPress’s file-handling capabilities allowing you to upload and manage various file types. Here are some popular plugins that can help:
To install the WP Extra File Types plugin navigate to the WordPress “Plugin” section then click “Add New Plugin”, search for the respective plugin click “Install Now” then “Activate” the plugin.
After activating the plugin navigate to the “Setting” section on WordPress. You can see the additional “Extra File Type” option. Click on it you can see the interface which allows you to integrate multiple file types:
Click the Save Changes button after selecting your preferred file type.
Learn about How to Fix Fatal Error: Maximum Execution Time Exceeded in WordPress.
Following are some important notes while resolving the WordPress file upload error:
By following these steps and considering the important notes you should be able to effectively resolve the “Sorry, you are not allowed to upload this file type” error in WordPress and successfully upload your desired files. Experiment with different approaches to find the best solution for your situation.
When it comes to buying hosting Ultahost is the best place to provide WordPress VPS hosting for bloggers, business owners, web designers, and developers. A customizable and scalable VPS is made just for you.
This error occurs when WordPress blocks certain file types for security reasons.
You can fix it by adding the file type to the allowed list in your WordPress settings.
By default, WordPress restricts some file types, but you can enable others through settings or plugins.
Allowing all file types can pose security risks so it is best to only allow trusted file types.
Plugins like “WP Extra File Types” allow you to safely enable additional file types.
Yes, you can modify your WordPress functions.php file to allow specific file types.
Updating WordPress might reset file type permissions requiring reconfiguration.
The internet is set on secure connections. When you enc...
The average internet user knows that one of the most an...
Two-factor authentication or 2FA adds an extra layer of...
WordPress is a powerful content management system used ...
WordPress a powerful content management system offers a...
An overloaded WordPress website can slow down your site...
Save my name, email, and website in this browser for the next time I comment.
Δ