I uploaded my PHP website or WordPress website to cPanel hosting, but I cannot upload large files because I am getting the upload_max_filesize limit error.
I am using cPanel or hPanel hosting, and my website works fine, but whenever I try to upload a large image, ZIP file, PDF, video, or plugin, I get an error saying that the uploaded file exceeds the maximum upload size allowed by PHP.
I have already tried changing the PHP version and editing some PHP settings, but the upload limit is still not increasing. I also contacted my hosting provider, but my problem has not been resolved.
I am using Hostinger hPanel and GoDaddy cPanel hosting.
How can I increase the upload_max_filesize limit in cPanel or hPanel?
How do I increase the PHP file upload limit for my PHP website or WordPress website?
Why am I getting the upload_max_filesize error while uploading files?
I have seen the upload_max_filesize error many times while working on PHP and WordPress projects. This error usually appears when you try to upload a large file.
For example, when you upload a large WordPress theme (like a 40 MB theme), a big plugin, or import a large SQL database file in PHP, you may see this error.
This is not a coding bug. It is actually a security limit set by your hosting server. Your hosting provider allows only a specific file upload size, and you can increase that limit according to your requirements.
Whether you are using cPanel or hPanel, both hosting panels provide options to increase the upload limit. You can also change other important PHP settings like memory_limit, post_max_size, and upload_max_filesize.
If you are using Hostinger hPanel, GoDaddy cPanel, or any other cPanel hosting, and you see the upload_max_filesize error in red while uploading a file, don't worry. You can fix it easily.
There is one important thing that many developers miss.
Sometimes, they increase only the upload_max_filesize, but the error still appears. I have also made this mistake before.
The reason is that upload_max_filesize, post_max_size, and memory_limit all work together.
For example, if your memory_limit is smaller than your upload_max_filesize, increasing only the upload limit will not solve the problem. You also need to increase memory_limit and post_max_size according to the file size you want to upload.
Now let me show you how to fix this error in both cPanel and Hostinger hPanel.
If you are using GoDaddy, Bluehost, HostGator, or any other hosting that provides cPanel, the steps are almost the same.
In most cPanel installations, these settings are saved automatically.
Note: If your cPanel doesn't have Select PHP Version, search for MultiPHP INI Editor. Select your domain, change the same values, and click Apply.
If you've only worked with cPanel before, hPanel may look a little different, but the process is very simple.
Follow these steps:
Finally, click the blue Save button.
If the above methods don't increase your upload limit and you're still getting the same error, you can also update the PHP limits using the .htaccess file.
This method is very simple.
php_value upload_max_filesize 128M
php_value post_max_size 128M
php_value memory_limit 256M
php_value max_execution_time 300
php_value max_input_time 300
Using these methods, you can easily increase upload_max_filesize, post_max_size, memory_limit, max_execution_time, and max_input_time.
One last thing I want to mention because I've seen many developers make this mistake.
Whenever you increase the upload_max_filesize, always make sure your memory_limit is higher than the upload size.
For example, if your memory_limit is 256M and you set upload_max_filesize to 300M, you'll still get the same error because PHP doesn't have enough memory to process the upload.
In that case, increase your memory_limit to 512M (or higher if needed), and the problem should be resolved.
This small setting is often the reason why the upload_max_filesize error continues to appear even after increasing the upload limit.