WooCommerce: Fix the “uploaded file exceeds the upload_max_filesize directive in php.ini” error

If you’re running a WooCommerce store and trying to upload a product image, import a CSV, or install a plugin/theme, you might encounter the dreaded “uploaded file exceeds the upload_max_filesize directive in php.ini” error.

This message means the file you’re trying to upload is larger than what your server currently allows. While this is more of a hosting/server-side limitation than a WooCommerce issue, it’s a common roadblock for store owners—especially those on shared hosting or dealing with large files.

The good news? You don’t necessarily need to mess with php.ini or contact your host right away. In many cases, you can override this upload limit with a quick tweak to your .htaccess file—something you likely already have in your root WordPress directory.

Let’s look at how to do that, and get rid of that error for good.

1. Open your .htaccess file via FTP or File manager

2. Add the following code at the bottom of .htaccess

# BEGIN Increase Max Upload Size
php_value upload_max_filesize 20M
php_value post_max_size 20M
php_value max_execution_time 300
php_value max_input_time 300
# END Increase Max Upload Size

Where to add custom code?

You should place custom PHP in functions.php and custom CSS in style.css of your child theme: where to place WooCommerce customization?

This code still works, unless you report otherwise. To exclude conflicts, temporarily switch to the Storefront theme, disable all plugins except WooCommerce, and test the snippet again: WooCommerce troubleshooting 101

Related content

Rodolfo Melogli

Business Bloomer Founder

Author, WooCommerce expert and WordCamp speaker, Rodolfo has worked as an independent WooCommerce freelancer since 2011. His goal is to help entrepreneurs and developers overcome their WooCommerce nightmares. Rodolfo loves travelling, chasing tennis & soccer balls and, of course, wood fired oven pizza. Follow @rmelogli

Questions? Feedback? Customization? Leave your comment now!
_____

If you are writing code, please wrap it like so: [php]code_here[/php]. Failure to complying with this, as well as going off topic or not using the English language will result in comment disapproval. You should expect a reply in about 2 weeks - this is a popular blog but I need to get paid work done first. Please consider joining the Business Bloomer Club to get quick WooCommerce support. Thank you!

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