mardi 26 janvier 2021

laravel how to save files with predefined name

in laravel controller i am trying to give each video file i uploading should be rename as

**myfile.mp4**

and save in public folder.

but my present code makes random number for my files but i need to give name as myfile

my controller

$input['file_id'] = time() . '.' . $request->file_id->getClientOriginalExtension();
        $folder1 = public_path('/public');
        $path1 = $folder1 . $input['file_id']; // path 1
        $request->file_id->move($folder1, $input['file_id']);


via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire