I was working on a Laravel application with version 7.30.4. The project was working fine. But recently I updated the Laravel version to version 8.0.0. The application is also working normally. But the image validation rule is not working anymore.
Here are my rules
$rules = [
'logo' => 'nullable|image|mimes:jpeg,bmp,png,jpg'
];
When I try to upload an image then it always gives the validation error
'The logo must be an image.'.
But in Laravel 7, I never faced this issue with the same file.
On my production server, the project is running on Laravel 7.30.4. I am afraid if I update the version on the production then the image validation no longer works.
The question is that, why the behavior of the image validation is not working for the Laravel 8.0 version which was working for the previous version.
Updates:-
- I also checked that the issue with the jpg/jpeg image.
- The PNG file is working fine but in the case jpg/jpeg image it always gives the above mention validation error.
- when I try to upload the BMP file then it gives the error "Unsupported image type. GD driver is only able to decode JPG, PNG, GIF, or WebP files."