use pathinfo() to extract file extension

This commit is contained in:
Uwe Steinmann 2014-06-16 14:30:13 +02:00
parent 1ef5cb0444
commit e803c4d657

View File

@ -149,9 +149,7 @@ if(is_readable($filename)) {
if(!$mimetype) {
$mimetype = $finfo->file($filename);
}
$lastDotIndex = strrpos(basename($filename), ".");
if (is_bool($lastDotIndex) && !$lastDotIndex) $filetype = ".";
else $filetype = substr($filename, $lastDotIndex);
$filetype = "." . pathinfo($filename, PATHINFO_EXTENSION);
} else {
echo "File has zero size\n";
exit(1);