Get 50% Discount Offer 26 Days

Recommended Services
Supported Scripts
WordPress
Hubspot
Joomla
Drupal
Wix
Shopify
Magento
Typeo3
How to Fix the upload_max_filesize Error in WordPress

When working with WordPress, you may encounter upload_max_filesize Error in WordPress when trying to upload a file:

This error occurs because the file you are trying to upload is over the size limitation set by your web servers PHP settings. This parameter is also written into the php.ini file and is called upload_max_filesize to show the maximum size of the uploaded files. Allowing anybody to upload a file larger than the limit will not be possible as WordPress will stop the upload and instead display the error message.

Why Does the upload_max_filesize Error Occur?

In fact, Web servers use access control and threshold of established security and performance restrictions must not be overused. One of these limitations is the file size that can be uploaded to the system and this is set by the PHP settings. By default, the upload_max_filesize is usually set to a small value such as 2MB and this is not preferable when uploading files such as themes, plugins or even images and videos.

How to Fix the upload_max_filesize Error

To resolve this issue, you’ll need to increase the upload_max_filesize setting. Here are a few methods you can try:

Fix the upload_max_filesize Error in WordPress

1. Modify the php.ini File

If you have full permissions to your server’s php.ini file you can tweak directly the upload_max_filesize value. Follow these steps:

  1. Locate the php.ini File
    The path of this directory is normally allocated in the root directory of your server or can be found in the PHP config files of your server. They are as follows: If you are using a shared type of hosting you will not be able to access this type of tool.

Edit the php.ini File
Open the php.ini file in a text editor and search for the following directives:

upload_max_filesize = 2M
post_max_size = 8M

Upload Max filesize and post max size should be increased to a particular value, for example, 64M or 128M. Always see to it that post_max_size is greater than upload_max_filesize for file uploads to run smoothly.

Example:

upload_max_filesize = 64M
post_max_size = 128M
  1. Restart PHP or Web Server
    After saving the changes, restart your web server or PHP service for the changes to take effect.

2. Edit .htaccess File

If you don’t have access to the php.ini file, you can try modifying the .htaccess file in your WordPress root directory. Here’s how:

  1. Access the .htaccess File
    Edit .htaccess file in the main directory of your WordPress site (if you don’t see it, make sure your file manager setting is set to show hidden files).

Add the Following Lines
Add these codes to the .htaccess file:

php_value upload_max_filesize 64M
php_value post_max_size 128M
php_value memory_limit 128M
php_value max_execution_time 300
php_value max_input_time 300
  1. These values can be change according to your needs (max_execution_time and max_input_time) settings are added to prevent timeouts during large uploads.
  2. Save and Exit
    After saving the changes, refresh your WordPress dashboard and try uploading your file again.

3. Create or Edit wp-config.php File

For users who do not have access to the server configuration files, you can also try adding the following lines to your WordPress wp-config.php file:

  1. Open wp-config.php
    This file is located in your WordPress main directory.

Add the Following Code
Add these lines just above the “/* That’s all, stop editing! Happy blogging. */” line:

@ini_set( 'upload_max_filesize' , '64M' );
@ini_set( 'post_max_size', '128M');
@ini_set( 'memory_limit', '128M' );
@ini_set( 'max_execution_time', '300' );
@ini_set( 'max_input_time', '300' );
  1. Save Changes
    After saving, try uploading your file again from the WordPress dashboard.

4. Contact Your Hosting Provider

If the previous methods do not work (especially on shared hosting), it’s possible that your host has restricted the file upload size. Reach out to your hosting provider chat support or open a ticket and ask them to increase the upload_max_filesize limit for you.

5. Use a Plugin (For Non-Technical Users)

If you’re not comfortable with code or file editing, you can use a plugin to modify the upload limits. Plugins like WP Maximum Upload File Size can make it easier to change upload limits directly from the WordPress dashboard.

Conclusion

The upload_max_filesize error in WordPress is a common issue that can be resolved by increasing the upload limits in your server’s PHP settings. You can try modifying the php.ini file, .htaccess file, or wp-config.php file, or use a plugin to make the changes. If none of these solutions work, contacting your hosting provider is the next best step.

By following these steps, you should be able to upload bigger files to your WordPress site without encountering the error.

About the writer

Vinayak Baranwal Article Author

Vinayak Baranwal wrote this article. Use the provided link to connect with Vinayak on LinkedIn for more insightful content or collaboration opportunities.

Leave a Reply

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

Lifetime Solutions:

VPS SSD

Lifetime Hosting

Lifetime Dedicated Servers