Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

upload a pdf file laravel

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.');
    }

    // ...
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #upload #pdf #file #laravel
ADD COMMENT
Topic
Name
1+8 =