How to Change Max Size of File Upload in PHP

In this tutorial, we are going to see how to change the max size of file upload in PHP. The maximum size of any file that can be uploaded to a website written in PHP is determined by the max_size values, mentioned in the server’s php.ini file. In case of a hosted server, you should contact the hosting server administrator. It is useful to create a local HTTP server for developers.

Procedure to change the maximum size of file upload, in case of a local server.

  • On Windows : C:\wamp\bin\apache\apache2.4.9\bin\php.ini

– If you use Xampp, you will find the php.ini file in the following path:

  • On Windows : C:\xampp\php\php.ini

In php.ini file, look for upload_max_filesize keyword and update its value with the desired file size for a larger file. By default, its value is set to 2Mb maximum. For example, you can set it to 20MB.

Then find post_max_size keyword and update its value to the maximum required value, which is the size of all content and files. For example, you can put 50MB.

Save the changes made and restart the server (Wamp or Xampp).

Note: upload_max_size limits the size of an attachment and post_max_size is the limit for all content.
mcqMCQPractice competitive and technical Multiple Choice Questions and Answers (MCQs) with simple and logical explanations to prepare for tests and interviews.Read More

Leave a Reply

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