I fixed this by changing the values of "post_max_size" & "upload_max_filesize" in php.ini to 128mb instead of 2 MB.
May 5, 2019
3
Level 1
Laravel 5.8 strange image upload validation error
Is it just me or is image validation uploading in Laravel 5.8 doesn't work properly? My form is configured correctly in blade view
<form action="{{url('admin/itemimageupload')}}" enctype="multipart/form-data" method="post">
<input required type="file" class="form control form-control-sm" id="files" name="images[]" multiple>
Controller validation
$request->validate([
'images' => 'required',
'images.*' => 'image|mimes:jpeg,png,jpg,gif,svg|max:2048'
]);
When I try to upload a VIDEO file, it shouldn't be allowed and i should get an error saying that, but instead i laravel throws a PostTooLargeException
Illuminate \ Http \ Exceptions \ PostTooLargeException No message
When I upload an 1 JPG file that's bigger than 2MB, I get the following error displayed in the errors output section of form blade view file.
The images.0 failed to upload.
When I try to upload 2 or more JPG files that are all larger than 2MB, I get thrown the same PostTooLargeException.
Level 1
1 like
Please or to participate in this conversation.