Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Laravel 5.5 - Image validation not working

For some reason my image validation refused to work on my laravel 5.5.28 application. It works perfectly on 5.4. I checked the documentation to see if there was a change in the documentation but there wasn't any.

Here is the validation logic for the image

'passport'=>'required|image|mimes:jpeg,png,jpg|max:1524',

HTML

<div class="form-group">
    <label>Upload a passport image</label>
    <input placeholder="upload passport" type="file" class="form-control" name="passport">
</div>

It returns both errors, image required and not png or jpeg etc... I have tried all to no avail.

Error messages

The passport must be an image. The passport must be a file of type: jpeg, png, jpg.

like image 702
M'Baku Avatar asked Dec 24 '22 11:12

M'Baku


1 Answers

I found my mistake, that is why make sure you put on your form enctype="multipart/form-data" , and error fixed

like image 64
Sodik Abdullaev Avatar answered Jan 19 '23 00:01

Sodik Abdullaev