Increase Maximum PHP File Upload Size

In this trick, we will see how we can increase the maximum file upload size in PHP. The default PHP values for upload_max_filesize is 2 MB and for post_max_size is 8 MB.

There are many shared hosts that have restrictions on the file upload size and you cannot alter it and it only allows you to upload files whose size is not more than their limit.

But there are also many hosts which allow you to change the default configuration of PHP by creating your own php.ini file. In this file, you can increase the file upload size and post max size or many other default variables in PHP.

So simply create a php.ini file in the public_html directory of your site if there is not one by default. Follow the steps to increase the maximum limit of file upload size in the PHP configuration file.

  1. Open the php.ini file in your editor.
  2. Search for “upload_max_filesize” variable and change its limit.
  3. Search the “post_max_size” variable and change its limit.
  4. Save the file and restart your server.

You can change the limit as per your requirements.

Being Tricky 😉

Leave a Reply

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