how to get file extension in laravel

149

how to get file extension in laravel -

//Where $file is an instance of Illuminate\Http\UploadFile
$extension = $file->getClientOriginalExtension();

laravel get extension from url -

$extension = pathinfo(storage_path('/uploads/my_image.jpg'), PATHINFO_EXTENSION);dd($extension);

Comments

Submit
0 Comments