How can I find a file when it's ext unknown and get his ext in PHP?
I wrote this code but its not working (the if returns false)... Thanks.
$pos_ext = array('jpeg', 'jpg', 'gif', 'png', 'tif', 'svg', 'bmp');
while($row = mysql_fetch_assoc($result))
{
for ($i = 0 ; $i <= 6 ; ++$i)
{
$file_name = "/" . $row['ID'] . "/headerpic." . $pos_ext[$i];
if (file_exists($file_name))
{
$ext = $pos_ext[$i];
}
}