php obtient l'extension du fichier à partir du nom de fichier
$ext = pathinfo($filename, PATHINFO_EXTENSION);
Geeky Bravo
$ext = pathinfo($filename, PATHINFO_EXTENSION);
$ext = pathinfo($filename, PATHINFO_EXTENSION);
//Remember that if you want to be able to deal with non ASCII characters, you need to set the locale first. E.G:
setlocale(LC_ALL,'en_US.UTF-8');
// your file
$file = 'image.jpg';
$info = pathinfo($file);
// Before PHP 5.2
$file_name = basename($file, '.'.$info['extension']);
// After PHP 5.2
$file_name = $info['filename'];