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
Post a Comment