3 if(!function_exists('mime_content_type')) {
4 function mime_content_type($filename) {
10 'html' => 'text/html',
13 'js' => 'application/javascript',
14 'json' => 'application/json',
15 'xml' => 'application/xml',
16 'swf' => 'application/x-shockwave-flash',
17 'flv' => 'video/x-flv',
21 'jpe' => 'image/jpeg',
22 'jpeg' => 'image/jpeg',
23 'jpg' => 'image/jpeg',
26 'ico' => 'image/vnd.microsoft.icon',
27 'tiff' => 'image/tiff',
28 'tif' => 'image/tiff',
29 'svg' => 'image/svg+xml',
30 'svgz' => 'image/svg+xml',
33 'zip' => 'application/zip',
34 'rar' => 'application/x-rar-compressed',
35 'exe' => 'application/x-msdownload',
36 'msi' => 'application/x-msdownload',
37 'cab' => 'application/vnd.ms-cab-compressed',
40 'mp3' => 'audio/mpeg',
41 'qt' => 'video/quicktime',
42 'mov' => 'video/quicktime',
43 'ogg' => 'application/ogg',
46 'pdf' => 'application/pdf',
47 'psd' => 'image/vnd.adobe.photoshop',
48 'ai' => 'application/postscript',
49 'eps' => 'application/postscript',
50 'ps' => 'application/postscript',
53 'doc' => 'application/msword',
54 'rtf' => 'application/rtf',
55 'xls' => 'application/vnd.ms-excel',
56 'ppt' => 'application/vnd.ms-powerpoint',
60 'odt' => 'application/vnd.oasis.opendocument.text',
61 'ods' => 'application/vnd.oasis.opendocument.spreadsheet',
64 if(strpos($filename,'.') !== false) {
65 $ext = strtolower(array_pop(explode('.',$filename)));
66 if (array_key_exists($ext, $mime_types)) {
67 return $mime_types[$ext];
70 elseif (function_exists('finfo_open')) {
71 $finfo = finfo_open(FILEINFO_MIME);
72 $mimetype = finfo_file($finfo, $filename);
77 return 'application/octet-stream';