php - Get an image extension from an uploaded file in Laravel -


i have been trying extension uploaded file, searching on google, got no results.

the file exists in path:

\storage::get('/uploads/categories/featured_image.jpg); 

now, how can extension of file above?

using input fields can extension this:

input::file('thumb')->getclientoriginalextension(); 

thanks.

you can use pathinfo() function built php that:

$info = pathinfo(storage_path().'/uploads/categories/featured_image.jpg'); $ext = $info['extension']; 

or more concisely, can pass option get directly;

$ext = pathinfo(storage_path().'/uploads/categories/featured_image.jpg', pathinfo_extension); 

Comments

Popular posts from this blog

javascript - Slick Slider width recalculation -

jsf - PrimeFaces Datatable - What is f:facet actually doing? -

angular2 services - Angular 2 RC 4 Http post not firing -