jeudi 10 mars 2022

How to Save File in storage folder with Original name?

I want to store an uploaded file with its original client name in the storage folder. What do I need to add or change in my code?Any help or recommendation will be greatly appreciated

Here my Controller

public function store(Request $request) {
    $path = "dev/table/".$input['id']."";
    $originalName = $request->file->getClientOriginalName();
    $file = $request->file;
    
    
    Storage::disk('local')->put($path, $file);
}

Edit: I know how to get the originalClientName. the problem is storing the file in the folder using the original name, not the hash name.I needed help on this specific part Storage::disk('local')->put($path, $file);



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/wcaUyuS
via IFTTT

Aucun commentaire:

Enregistrer un commentaire