how can i upload original filename (file.jpg) to database when submitting file via form. Controller:
public function addCv(Request $request){
$cv = Cv::create($request->all());
$file = $request->file_name;
$filename = $file->getClientOriginalName();
Storage::putFileAs('public/uploads', $file, $filename);
return redirect()->back();
}
at the moment, this function uploads a path like this C:\xampp\tmp\php18DD.tmp. Instead of that i want just filename and extension (file.extension).
Storage is working fine - storing with original name.
You could try
$file = $request->image->getClientOriginalName(); //Get Image Name
$extension = $request->image->getClientOriginalExtension(); //Get Image Extension
$fileName = $file.'.'.$extension; //Concatenate both to get FileName (eg: file.jpg)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With