Level 75
Have a list of possible extensions to Loop through and if it's one of those extensions, I think you get the idea from there.
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Hi ,
i'm storing an image in my public/image folder through the upload function .
For the upload , its easy to get the extension : ->getClientOriginalExtension()
However now i want to retrieve that file ...i know the name but i don;t know the extension (jpg , png etc...)
how can i retrieve that file ?
$folder = base_path() . '/public/image/';
$name ="yyy";
$path = $folder.$name;
// does not work as i'm calling this on a url rather than the file
$img_type = $img_path->getClientOriginalExtension();
Please or to participate in this conversation.