Did you check your form and if there is enabled enctype="multipart/form-data" or file=> true in Html Form package ?
Form request image validation differences between 5.1 and 5.2
I'm in the process of upgrading an app from Laravel 5.1 to 5.2. The application is an API and one of the endpoints accepts an image upload named 'avatar'. In Laravel 5.1, the following validation rule works:
public function rules()
{
return [
'avatar' => 'required|image'
];
}
However, in 5.2, I get the error 'Avatar must be an image'. When dumping $request->avatar, I can see that it is an instance of Illuminate\Http\UploadedFile as expected.
Any ideas?
For anyone else that has this problem, the issue was not in the validator at all. There is a bug in Laravel 5.2 from converting Symfony UploadedFile objects with the "test" attribute as true to Laravel's similar UploadedFile object. In my tests, I was uploading Symfony UploadedFile file objects with "test" = true. By changing these to Illuminate\Http\UploadedFile it works.
Please or to participate in this conversation.