Upload more than 1 MB file in PHP.

Read {count} times since 2020

Some may have problem with uploading file more than 1 MB or 2 MB. You can fix this by editing the configuration file of PHP. To fix this follow the steps.

Open Root Terminal (Applications -> System Tools -> Root Terminal).

sudo gedit /etc/php5/apache2/php.ini 

and press enter key.
You will get gedit application with the php.in file.

Search for the words post_max_size upload_max_filesize.
If you found the words you will see a = after the word post_max_size upload_max_filesize.

Change the number as you want (Default will be 1M or 2M).
After editing save the file and restart Apache Web Server by opening Root Terminal and pasting this code

sudo /etc/init.d/apache2 reload

and press enter.
That’s it. Upload a file in PHP and see the magic !

Show Comments