- function attachtype($type, $returnval = 'html') {
- static $attachicons = array(
- 1 => 'unknown.gif',
- 2 => 'binary.gif',
- 3 => 'zip.gif',
- 4 => 'rar.gif',
- 5 => 'msoffice.gif',
- 6 => 'text.gif',
- 7 => 'html.gif',
- 8 => 'real.gif',
- 9 => 'av.gif',
- 10 => 'flash.gif',
- 11 => 'image.gif',
- 12 => 'pdf.gif',
- 13 => 'torrent.gif'
- );
- if(is_numeric($type)) {
- $typeid = $type;
- } else {
- if(preg_match("/bittorrent|^torrent\t/", $type)) {
- $typeid = 13;
- } elseif(preg_match("/pdf|^pdf\t/", $type)) {
- $typeid = 12;
- } elseif(preg_match("/image|^(jpg|gif|png|bmp)\t/", $type)) {
- $typeid = 11;
- } elseif(preg_match("/flash|^(swf|fla|flv|swi)\t/", $type)) {
- $typeid = 10;
- } elseif(preg_match("/audio|video|^(wav|mid|mp3|m3u|wma|asf|asx|vqf|mpg|mpeg|avi|wmv)\t/", $type)) {
- $typeid = 9;
- } elseif(preg_match("/real|^(ra|rm|rv)\t/", $type)) {
- $typeid = 8;
- } elseif(preg_match("/htm|^(php|js|pl|cgi|asp)\t/", $type)) {
- $typeid = 7;
- } elseif(preg_match("/text|^(txt|rtf|wri|chm)\t/", $type)) {
- $typeid = 6;
- } elseif(preg_match("/word|powerpoint|^(doc|ppt)\t/", $type)) {
- $typeid = 5;
复制代码
注意看这里的图标,是个问号.原因是代码设置里面未识别最新的office2013的后缀导致.
注意倒数第二行的这一段代码:
} elseif(preg_match("/word|powerpoint|^(doc|ppt|xls|docx|pptx|xlsx)\t/", $type)) {
把office2013后缀添加进去,系统就可以自动识别啦.
文件是在source\function目录中的function_attachment.php
改完之后,我们就会发现系统已经识别此文件类型.
|