Jonjie's avatar
Level 12

Why uploading > 2mb file always return the validation error

I'm trying to validate the file upload on my project but it always return a file size exceeds error. Please see my code below.

Validation

$request->validate([
    'attachments.*.file' => 'file|max:60000'
]);

Input field

<div class="col pr-0">
    <label>Attach File</label>
    <input name="attachments[0][file]" type="file" class="form-control-file">
</div>

Error print

@error('attachments.*.file')
    <div>Some attached files exceeds the maximum upload limit</div>
@enderror
0 likes
2 replies
anilkumarthakur60's avatar
Level 6

there must be a php folder and php.ini in it. By default upload_max_filesize = 2M, but you can customize it. You can check the default value if you run phpinfo().

1 like
Jonjie's avatar
Level 12

Oh I see. Now it's working. I just needed to run php -r "phpinfo();" | grep php.ini to check what php.ini is being executed.

Please or to participate in this conversation.