嘿,你们需要这方面的帮助。我发现laravel 5.5的文件系统使我读文档时感到困惑,但仍然感到困惑,如何检索和查看上传的文件?这是我的控制器:
SoleDistcontroller.blade.php
public function store(Request $request)
{
//
$Record=new SoleDist;
$Record->name = $request->get('name');
$Record->address = $request->get('address');
$path = Storage::putFile('certificates',$request->file('certificate'));
$Record->file_name = $path;
$Record->save();
return redirect()->back()->with('flash_message','Sole Distributor added successfully!');
}
/**
* Display the specified resource.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function show($id)
{
//
$Record = SoleDist::find($id);
$url = Storage::get($Record->file_name);
return redirect($url);
}