Get an image extension from an uploaded file in Laravel
The Laravel way
Try this:
$foo = \File::extension($filename);
Tested in laravel 5.5
$extension = $request->file('file')->extension();
Yet another way to do it:
//Where $file is an instance of Illuminate\Http\UploadFile
$extension = $file->getClientOriginalExtension();