I'm trying to save the name of the image in the database from Laravel, I could get the name of the file but I get an error in the code:
$name = time().'_'.$file->getClientOriginalExtension();
and then I do not know what the error is, what I have up to now is to save the image in a laravel route, and see it come out but obviously it does not work because of the error:
if ($file = $request->foto){
$file = $request->file('foto');
$file = $request->foto;
$name = time().'_'.$file->getClientOriginalExtension();
dd($name);
}
How can I solve it?