How to increase Maximum upload file size from 2MB

I deployed my laravel project on digital ocean and when I try to upload a file, I get an error saying, ‘upload file size is 2MB’. Please help me solve this issue people. Am using an APP, DATABASE and SPACE.

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Hello @nathanmwamba2002 ,

You can create a PHP info file in order to check the current values and check which is the php.ini file in use. Create the following file in your public_hmtl folder - phpinfo.php and put the following code inside it:


You can also use the following command in order to find the location of the php.ini file:

php -i | grep php.ini

The output will be similar:

Configuration File (php.ini) Path => /etc/php/8.0/cli
Loaded Configuration File => /etc/php/8.0/cli/php.ini

Then check for the current value of upload_max_filesize you can also check which is the configuration file - php.ini that is currently used and apply the changes there (if the site using the global php.ini file and you change the values for these settings this will make the changes globally for all sites). Ideally, you would like to have the following values:

upload_max_filesize = 64M

You also need to restart your web server in order for the changes to take effect, so if you’re running Apache restart the Apache service or if you’re running Nginx you’ll need to restart Nginx.

Hope that this helps! Regards, Alex

Hi @nathanmwamba2002,

If you are using App Platform for your Laravel Application you’ll need to follow these steps:

PHP applications on App Platform use PHP-FPM in conjunction with Apache (or Nginx if you choose to use it)—the webserver would accept all incoming requests, and forward PHP requests to PHP-FPM which actually executes them. You’ll want to increase the max upload size there. You can do that by adding a .user.ini file at the root of your app’s document root (in the same directory where you would put an .htaccess file. Usually this will be the public directory) with something like this:

post_max_size = 20M
upload_max_filesize = 5M

post_max_size controls the maximum POST requests body size, while upload_max_filesize controls the maximum allowed size of a single file in an upload request.

For more info you can refer to the Heroku PHP Buildpack documentation. Let me know if that works!

If you have a simple droplet though, you just need to find the PHP installation and edit the php.ini file and increase the post_max_size and upload_max_filesize. As for the location of the file, it’s Usually at the following place /etc/php/7.4/apache2/php.ini ofcourse, if you are using another PHP version, you’ll need to change the number from 7.4 to whatever you are using.