note 28762 deleted from function.filetype by sniper
| From: | sniper@php.net | Date: | Fri, 31 Oct 2003 13:36:31 +0000 |
| Subject: | note 28762 deleted from function.filetype by sniper | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-59581@lists.php.net to get a copy of this message | ||
Note Submitter: head@start.no
----
If it's the mime-type you are after, you could parse the mime.types file (in *NIX):
$file = file('/etc/mime.types');
foreach($file as $line) {
rtrim($line);
if (preg_match('/^\#/', $line))
continue;
$elms = preg_split('/\s+/', $line);
$type = array_shift($elms);
foreach ($elms as $elm) {
$mime[$elm] = $type;
}
}
Example: $mime[pdf] will return "application/pdf" (or whatever your mime.types file
contains).