PHP uses ini directives to control the maximum upload file size. There are two directives in the php.in file that affect what will be the maximum allowed upload size.
upload_max_filesize : It is the actual limit. By default it is set to 2M ( The default maximum upload size is 2MB)
post_max_size : It controls the maximum size of the post request. This should be set larger than theĀ upload_max_filesize.
Example:-
For example, to allow files upto 10MB to be uploaded, we can do the following.
1. Update upload_max_filesize to 10 MB as shown below.
1 | upload_max_filesize = 10M |
2. Update post_max_size to 12 MB(a bit larger that the upload size) as shown below
1 | post_max_size = 12M |
That’s it.
If you are not sure what the above values are, Please contact your hosting provider and ask them to update the upload file size limit for you. If the changes are not working even after applying in ini file, please make sure to restart the webserver(apache/nginx etc) to force reload the config.