如何在Laravel中查看上传的pdf文件?

时间:2018-10-16 04:48:43

标签: php laravel pdf laravel-5.5

嘿,你们需要这方面的帮助。我发现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);
    } 

0 个答案:

没有答案