Or, if you have the [man]mimetype[/man] functions available to you, you can use [man]mime_content_type[/man]. If you instead have the [man]fileinfo[/man] functions available to you, since the mimetype functions are deprecated in favor of these more advanced functions, you can use something like the coding example found on the manual page for [man]finfo_file/man.