- pathinfo: documentation ( source)
<?php
$file_name = 'whatever.zip';
$file_types = array("zip" => "Application/Octet-Stream");
$file_extension = pathinfo($file_name, PATHINFO_EXTENSION);
echo $file_types[$file_extension]; // displays Application/Octet-Stream
?>