我收到以下错误消息。
/storage/images/AiOCjhpQX14cfDq4qxj5AUdWMeAyfelc8RH0rCUw.png(404不是 找到)
控制器
public function store(Request $request)
{
$this->validate($request, [
'name' => 'required|string|max:255',
'image' => 'required|image|mimes:jpg,jpeg,png',
]);
$file = request()->file('image') ? request()->file('image')->store('images', 'public') : null;
$product = product::create([
'name' => $request['name'],
'description' => $request['description'],
'entityprice' => $request['entityprice'],
'individualprice' => $request['individualprice'],
'category_id' => $request['techspec'],
'is_active' => $request['is_active'],
'image' => $file,
]);
return redirect()->route('products.index', $product);
}
刀片
<div class="form-group">
<label for="image" class="col-form-label">Image</label>
<input id="image" type="file" class="form-control{{ $errors->has('image') ? ' is-invalid' : '' }}" name="image" value="{{ old('image') }}">
@if ($errors->has('image'))
<span class="invalid-feedback"><strong>{{ $errors->first('image') }}</strong></span>
@endif
</div>
我得到的错误: