Laravel 8 我无法验证图像类型
Laravel 8 I cant verify image type
您好,我无法使用 mimes:jpg,jpeg,png
验证我的图像类型
我正在将此发送给 api
"images": [
{
"imageId": 0,
"size": 1036822,
"name": "scott-webb-hDyO6rr3kqk-unsplash.jpg",
"type": "jpeg",
"belongsTo": 0
}
]
此类型之前是 'image/jpeg'
但我得到同样的错误:
images.0.type: Array(1)
0: "The images.0.type must be a file of type: jpeg, jpg."
这是验证:
$request->validate([
'images.*.type' => 'mimes:jpeg,jpg',
]);
试试这个
$this->validate($request,
['image' => 'image|mimes:jpeg,png,jpg,gif,svg|max:2048',]);
您好,我无法使用 mimes:jpg,jpeg,png
我正在将此发送给 api
"images": [
{
"imageId": 0,
"size": 1036822,
"name": "scott-webb-hDyO6rr3kqk-unsplash.jpg",
"type": "jpeg",
"belongsTo": 0
}
]
此类型之前是 'image/jpeg'
但我得到同样的错误:
images.0.type: Array(1)
0: "The images.0.type must be a file of type: jpeg, jpg."
这是验证:
$request->validate([
'images.*.type' => 'mimes:jpeg,jpg',
]);
试试这个
$this->validate($request, ['image' => 'image|mimes:jpeg,png,jpg,gif,svg|max:2048',]);