Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

narorth's avatar

Upload file laravel

Hi All Please help Me Where upload file 150MB is Successfully But file 170MB Show Error Illuminate \ Session \ TokenMismatchException on server php.ini post_max_size 200M upload_max_filesize 250M

0 likes
9 replies
jekinney's avatar

Might need to up the time out time. Also file size is not all. Meaning different types upload differently. png vs MP3 of the same size the MP3 will take longer.

1 like
willvincent's avatar

That error is not related to file size, it's a session issue, or perhaps a CSRF issue. How are you doing the uploads, what does the route look like, what does the controller look like, etc.. there's much to understand to be able to debug this, but I am 99% certain it has nothing to do with your upload file size.

1 like
mehany's avatar

@narorth try to refresh the page and upload the file then let us know what you get.

1 like
narorth's avatar

i show Exception When upload File Warning: POST Content-Length of 205016829 bytes exceeds the limit of 104857600 bytes in Unknown on line 0

mehany's avatar

ok great. now we get another error. This one instead say that you need to increase the upload_max_filesize in php.ini or client_max_body_size in nginx config which has to do with the allowed file size to upload. reference

Edit: sorry I forgot to ask, what stack are you developing on? If homestead, then run sudo service php5-fpm restart

1 like
narorth's avatar

in php.ini I add ready post_max_size = 500MB upload_max_filesize = 500MB but doesn't work

mehany's avatar

@narorth I assume you are running php5 on you local server so I think you need to just restart the PHP-FPM and the changes will take effect.

willvincent's avatar
Level 54

is it nginx? You may need to update the nginx config as well if so. Also, there may be different settings for php-fpm than those in php.ini.

Add a call to phpinfo() somewhere accessible (usually a file like info.php in your public directory with the following contents is sufficient)

<?php

phpinfo();

That'll let you see all the php settings in play when running with the webserver, vs using php on the cli.

If you're running nginx, you may need to update it's config to allow for larger max body size... These are the settings I've used on my production server for several years without any issue:

  client_max_body_size      2000M;
  client_body_buffer_size   128k;
2 likes
narorth's avatar

Thank You so much all. Now it work. is problems File .htaccess php_value upload_max_filesize 100M php_value post_max_size 100M lol

Please or to participate in this conversation.