作者 邓超

修复扩展名bug

@@ -50,11 +50,13 @@ class Attachment { @@ -50,11 +50,13 @@ class Attachment {
50 return $this->extension; 50 return $this->extension;
51 } 51 }
52 // 在 mime文件类型中查找 52 // 在 mime文件类型中查找
53 - if(is_file('mime.types') && $this->getFileType()){  
54 - $type = file_get_contents('mime.types');  
55 - $type = explode("\r\n",$type); 53 + $a = is_file(__DIR__.'/mime.types');
  54 + if($a && $this->getFileType()){
  55 + $type = file_get_contents(__DIR__.'/mime.types');
  56 + $type = explode("\n",$type);
56 foreach ($type as $item){ 57 foreach ($type as $item){
57 if(stripos($item,$this->getFileType())===0){ 58 if(stripos($item,$this->getFileType())===0){
  59 + $item = str_replace("\t"," ",$item);
58 list($t,$e) = explode(' ',$item,2); 60 list($t,$e) = explode(' ',$item,2);
59 $e = trim($e); 61 $e = trim($e);
60 if($e){ 62 if($e){