PHP Configuration - Change Upload Size Limit

In this article, lets see how to change upload file size limit in php server perfect without any mistakes or errors using php.ini file.

In PHP Configuration file is named as php.ini , this file was located at /etc/php/7.4/cli/php.ini

1 - Open terminal and cd to above given path
2 - Type, sudo nano php.ini
3 - This will open php.ini file in edit mode
4 - Look for following keywords,


These 4 keywords value have to be changed. Lets see one by one with some details below,

upload_max_filesize : Maximum file size that can be uploaded.

post_max_size : Using POST maximum file size that can be uploaded. Make sure this value is greater than upload_max_filesize.

file_uploads : This value allow to upload files. Make sure this value is On.

max_file_uploads : Maximum files can be uploaded in single upload.

Example :

upload_max_filesize : 200M
KB = K
MB = M
GB = G
note : 2000M is equal to 2G.

post_max_size : 200M
KB = K
MB = M
GB = G
note : make sure this value is equal or higher than upload_max_filesize.

file uploads : On
On - to enable uploads
Off - to disable uploads

max_file_uploads : 1
1 - uploads one file at a time
2 - uploads two file at a time
and so on..

5 - That's all, Press Ctrl+X , It'll ask for Save or not.
6 - Press Y and Press enter, This mean save and exit.
7 - All done now as per your configuration php server upload will work fine.

If you need good working php file upload code with progress bar - click here to download (will upload later).

Post a Comment

Previous Post Next Post