I have been trying to get the extension from an uploaded file, searching on google, I got no results.
The file already exists in a path:
\Storage::get('/uploads/categories/featured_image.jpg);
Now, How can I get the extension of this file above?
Using input fields I can get the extension like this:
Input::file('thumb')->getClientOriginalExtension();
Thanks.
Yet another way to do it:
The Laravel way
Try this:
You can use the pathinfo() function built into PHP for that:
Or more concisely, you can pass an option get get it directly;
If you just want the extension, you can use
pathinfo
:Tested in laravel 5.5
Or can use the Extension Splitter
Trickster::getExtention()
function of https://github.com/secrethash/tricksterTrickster::getExtention('some-funny.image.jpg');
It returnsjpg