To me, the image rule seems a bit redundant since you're checking the extension anyway using mimes? Do they check different things? 🤔
Laravel 6 image validation failure
I just recently upgraded an existing app to Laravel 6 and testing everything out and my image upload validation now fails.
Its currently working fine on live production site, zero changes to existing controller and formRequest but getting error => The media must be an image
I am uploading an image and the formRequest rules are:
public function rules()
{
return [
'media' => [
'required',
'image',
'max:3072',
'mimes:jpeg,png,jpg',
Rule::dimensions()->minWidth(700)->minHeight(500)
],
];
}
So it worked in 5.8 but fails in 6.0
If I simply by-pass the formRequest and skip that step the controller handles the upload with no errors so the upload functionality / saving / resizing all works fine.
Its simply when passing the request thru the formRequest it fails. If I remove "image" from rules array Laravel detects the file is or is not an specific mime type, size and dimensions but will fail if the image rule is added.
Any ideas?
weird may be while update has some error ?
can you check the source code is exactly like this ?
Please or to participate in this conversation.