在 ArticleController.php 中,数据以适当的扩展名上传到存储目录中,但在 homestread 数据库中,上传的照片数据为“/tmp/phpBqfse2”
public function store(Request $request)
{
Article::create($this->validateForm());
if ($request->hasFile('photo'))
{
$fileName = $request->photo->getClientOriginalName();
$request->photo->storeAs('uploads', $fileName, 'public');
}
return redirect()->route('article.index')->with('success', 'Article data has been uploaded
successfully');
}
**In index.blade.php the data is not fetched by the following code **
<img src="{{ asset('uploads/'. $article->photo) }}" alt="Photo">
**Note**
storage is linked
php artisan storage:link