mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-09 03:32:00 +09:00
Add MIME class
This commit is contained in:
parent
25cf1856a6
commit
a9d6cf598d
3 changed files with 175 additions and 75 deletions
|
|
@ -460,81 +460,7 @@ class Mail
|
|||
*/
|
||||
function returnMIMEType($filename)
|
||||
{
|
||||
preg_match("|\.([a-z0-9]{2,4})$|i", $filename, $fileSuffix);
|
||||
switch(strtolower($fileSuffix[1]))
|
||||
{
|
||||
case "js" :
|
||||
return "application/x-javascript";
|
||||
case "json" :
|
||||
return "application/json";
|
||||
case "jpg" :
|
||||
case "jpeg" :
|
||||
case "jpe" :
|
||||
return "image/jpg";
|
||||
case "png" :
|
||||
case "gif" :
|
||||
case "bmp" :
|
||||
case "tiff" :
|
||||
return "image/" . strtolower($fileSuffix[1]);
|
||||
case "css" :
|
||||
return "text/css";
|
||||
case "xml" :
|
||||
return "application/xml";
|
||||
case "doc" :
|
||||
case "docx" :
|
||||
return "application/msword";
|
||||
case "xls" :
|
||||
case "xlt" :
|
||||
case "xlm" :
|
||||
case "xld" :
|
||||
case "xla" :
|
||||
case "xlc" :
|
||||
case "xlw" :
|
||||
case "xll" :
|
||||
return "application/vnd.ms-excel";
|
||||
case "ppt" :
|
||||
case "pps" :
|
||||
return "application/vnd.ms-powerpoint";
|
||||
case "rtf" :
|
||||
return "application/rtf";
|
||||
case "pdf" :
|
||||
return "application/pdf";
|
||||
case "html" :
|
||||
case "htm" :
|
||||
case "php" :
|
||||
return "text/html";
|
||||
case "txt" :
|
||||
return "text/plain";
|
||||
case "mpeg" :
|
||||
case "mpg" :
|
||||
case "mpe" :
|
||||
return "video/mpeg";
|
||||
case "mp3" :
|
||||
return "audio/mpeg3";
|
||||
case "wav" :
|
||||
return "audio/wav";
|
||||
case "aiff" :
|
||||
case "aif" :
|
||||
return "audio/aiff";
|
||||
case "avi" :
|
||||
return "video/msvideo";
|
||||
case "wmv" :
|
||||
return "video/x-ms-wmv";
|
||||
case "mov" :
|
||||
return "video/quicktime";
|
||||
case "zip" :
|
||||
return "application/zip";
|
||||
case "tar" :
|
||||
return "application/x-tar";
|
||||
case "swf" :
|
||||
return "application/x-shockwave-flash";
|
||||
default :
|
||||
if(function_exists("mime_content_type"))
|
||||
{
|
||||
$fileSuffix = mime_content_type($filename);
|
||||
}
|
||||
return "unknown/" . trim($fileSuffix[0], ".");
|
||||
}
|
||||
return Rhymix\Framework\MIME::getTypeByFilename($filename);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue