<?php
if (function_exists('mime_content_type')) {
$ctype = mime_content_type($file);
} else {
$pathinfo = pathinfo($file);
$mime = Array(
'rar' => 'application/x-tar',
'zip' => 'application/x-zip-compressed',
'asf' => 'video/x-ms-asf',
'wmv' => 'video/x-ms-wmv',
'aiff' => 'audio/aiff',
'au' => 'audio/basic',
'mid' => 'audio/mid',
'mp3' => 'audio/mpeg',
'wav' => 'audio/wav',
'wma' => 'audio/x-ms-wma',
'avi' => 'video/x-msvideo',
'ivf' => 'video/x-ivf',
'mpeg' => 'video/mpeg',
'mpg' => 'video/mpeg',
'mpe' => 'video/mpeg',
'qt' => 'video/quicktime',
'mov' => 'video/quicktime',
'art' => 'image/x-jg',
'bmp' => 'image/bmp',
'gif' => 'image/gif',
'jpg' => 'image/jpg',
'swf' => 'application/futuresplash',
'tiff' => 'image/tiff',
'pdf' => 'application/pdf',
'html' => 'text/html',
'htm' => 'text/html',
'xls' => 'application/x-msexcel',
'doc' => 'application/msword',
'rtf' => 'application/msword',
'rtx' => 'text/richtext',
'xml' => 'text/xml',
'hta' => 'application/hta',
'css' => 'text/css',
'txt' => 'text/plain'
);
isset($mime[$pathinfo['extension']]) ? $ctype = $mime[$pathinfo['extension']] : $ctype = 'application/octet - stream';
}
?>