This is a question you can read everywhere on the web with various answers:
$ext = end(explode(\'.\', $filename)); $ext = substr(strrchr($filename, \'.\'), 1
ltrim(strstr($file_url, '.'), '.')
this is the best way if you have filenames like name.name.name.ext (ugly, but it sometimes happens