您好,我無法驗證我的影像型別 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',
]);
uj5u.com熱心網友回復:
嘗試這個
$this->validate($request, ['image' => 'image|mimes:jpeg,png,jpg,gif,svg|max:2048',]);
轉載請註明出處,本文鏈接:https://www.uj5u.com/shujuku/376465.html
標籤:图片 验证 laravel-8 laravel-api
上一篇:導航欄鏈接沒有變小
