在Laravel中找不到图像404

时间:2019-01-15 12:07:07

标签: php laravel

我收到以下错误消息。

  

/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>

我得到的错误:

404 error

0 个答案:

没有答案