By default, PHP allows uploading maximum 2 MB file on the server. But you can change the maximum size of file upload as per your requirement. Using the PHP configuration file (
php.ini), you can increase or decrease the file upload size in PHP.
The upload_max_filesize and post_max_size variable’s value need to be modified in
php.ini file. Follow the below steps to increase the limit of file upload size in PHP.
- Open the php.ini file in the text editor.
- Search for upload_max_filesize variable and specify the size which you want to increase.
upload_max_filesize = 128M
- Search for post_max_size variable and specify the size which you want to increase. (Basically it same as
post_max_size = 128M
- Once done, save the modified php.ini file and restart the server.