How to increase uplaod file size in php

In this programming tutorial we will learn how to increase upload file size in php. Doing so is quite easy in php by changing some default values in php.ini file or in .htaccess file, depends upon your hosting situation. php.ini file is the configuration file that contains all the settings related to your website. So let's have a look over how to accomplish what we want.
How to increase uplaod file size in php
You have to update the values of post_max_size and upload_max_filesize in php.ini file. Since post_max_size is the limit for all the content of your post, many developers want post_max_size to be a multiple of upload_max_filesize to allow multiple files to be uploaded, but this is not necessary. The upload module limits the size of a single attachment to be less than either post_max_size, or upload_max_filesize, whichever is smaller. The default value for upload_max_filesize is 2 MB, and default value for post_max_size is 8 MB.

For instance, to increase the limit on uploaded files to 10 MB:

Perform below mentioned changes to the php.ini file. Remember, for some hosts this is a system-wide setting.
  • upload_max_filesize = 10M
  • post_max_size = 10M
So that's it. I hope you will find this tutorial very handy.

I love your feedback.

0 comments: