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

sanypratama's avatar

Pots to Large Exception

im using laravel 5.4

so i make some validate like this :

  $this->validate($request,[
        'jenis'=> 'required',
        'file'=>'mimes:doc,docx,pdf|max:4999' 
      ]);

and if upload more than 4999 if will get me error like this : https://pasteboard.co/HsDUOQt.png

my question is, how to make the error is not appears, if user upload more than 4999 is just give him error massage like "ur file is too big" in php please, no jquary :) thanks for your help

and im sorry if my english broken, coz english is not my first language :)

0 likes
2 replies
Sergiu17's avatar

Instead of max:4999 use size:4999 and if file will be bigger than 4999, validator will redirect back with error messages laravel.com/docs/5.6/validation#quick-displaying-the-validation-errors

Snapey's avatar

post too large exception is not related to validation. It is because you have hit the limit of the php.ini setting.

You need to change post_max_size and upload_max_filesize

You can check the current values easily in tinker

php artisan tinker

>>> ini_get('post_max_size')

>>> ini_get('upload_max_filesize')

Please or to participate in this conversation.