[PHP Snippet] Get MIME Type of file

Here is short PHP Snippet to get the MIME type of a file:

function getMime($file) {
$finfo = finfo_open(FILEINFO_MIME_TYPE);
$mime = finfo_file($finfo, $file);
finfo_close($finfo);
return $mime;
}

Usage:

getMime("myTextFile.txt");