📜  上传 pdf 文件 laravel - PHP 代码示例

📅  最后修改于: 2022-03-11 14:54:48.102000             🧑  作者: Mango

代码示例2
class FileController extends Controller
{
    // ...

    public function upload(Request $request)
    {
        $uniqueFileName = uniqid() . $request->get('upload_file')->getClientOriginalName() . '.' . $request->get('upload_file')->getClientOriginalExtension());

        $request->get('upload_file')->move(public_path('files') . $uniqueFileName);

        return redirect()->back()->with('success', 'File uploaded successfully.');
    }

    // ...
}