I have used Input::file(\'upfile\')->getClientOriginalName()
to retrieve name of uploaded file but gives name with extension like qwe.jpg
.How do I g
In Laravel 7 the Fluent Strings were introduced which allows to do this in an extremely elegant way.
The basename
method will return the trailing name component of the given string:
use Illuminate\Support\Str;
$string = Str::of('/foo/bar/baz.jpg')->basename();
// 'baz.jpg'
If needed, you may provide an "extension" that will be removed from the trailing component:
use Illuminate\Support\Str;
$string = Str::of('/foo/bar/baz.jpg')->basename('.jpg');
// 'baz'