-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmimetype.php
45 lines (42 loc) · 1.47 KB
/
mimetype.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
<?php
class MimeType {
var $dict;
function MimeType() {
$this->dict = array(
"bin" => "application/octet-stream",
"bmp" => "image/bmp",
"doc" => "application/msword",
"docx" => "application/msword",
"gif" => "image/gif",
"gtar" => "application/x-gtar",
"gz" => "application/x-gzip",
"gzip" => "application/x-gzip",
"htm" => "text/html",
"html" => "text/html",
"jara" => "application/jar-archive",
"jpeg" => "image/jpeg",
"jpg" => "image/jpeg",
"pdf" => "application/pdf",
"png" => "image/png",
"pot" => "application/mspowerpoint",
"pps" => "application/mspowerpoint",
"ppt" => "application/mspowerpoint",
"pptx" => "application/mspowerpoint",
"rtf" => "application/rtf",
"tar" => "application/x-tar",
"w6w" => "application/msword",
"word" => "application/msword",
"xla" => "application/msexcel",
"xls" => "application/msexcel",
"xlt" => "application/msexcel",
"xlw" => "application/msexcel",
"xlsx" => "application/msexcel",
"zip" => "application/zip"
);
}
function getMimeType($filename) {
$path_info = pathinfo($filename);
$extension = $path_info["extension"];
return $this->dict[$extension];
}
}