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

tallaljamshed's avatar

10mb file validation problem

This is a strange problem for me. i'm validating file with max:5000 . Then i'm uploading a file of size 9,980kb it gives the error "Allowed file size is 5000" which is perfectly fine. but when im uploading a file of size 10,367kb (more then 10mb), it does give me error but like this "The std file failed to upload". I mean i have a custome message right there, but its not showing that on 10mb file,

$validator = Validator::make($request->all(),[
            'std_file'=>['required','file','max:5000'],
        ],[
            'std_file.required' => "Please Select a File to Upload",
            'std_file.file' => "Invalid file type",
            'std_file.max' => "Allowed file size is :max",
        ]);
0 likes
5 replies
ftiersch's avatar

Probably it's running into a webserver limitation (either an nginx/apache setting or a php setting) that doesn't allow files larger than 10mb to be uploaded at all. So the validation doesn't get a file to validate basically.

tallaljamshed's avatar

But you see the error is from laravel . So the file is actually passing through with correct name "std_file". but laravel is not sending back custom message , that is what confusing me , and the PHP (max post size error) comes on 12mb file not on 10mb. also the max_post_size on php config is 40M. SO ITS ALL VERY CONFUSING

Snapey's avatar

Make sure you create a page with phpInfo() and check the values that are in effect because you can have different results from CLI versus web

tallaljamshed's avatar

So u mean in base64 .Atleast data wont get truncated ? then i can just increase post_max_size?.

Please or to participate in this conversation.