MIME类别"application/zip"不是容许的文件格式。
如果是wiki出问题,则是在includes/mime.types里面
添加
application/zip zip
但是实际检查有,查看一下是否支持zip,unzip发现没有,安装
sudo apt-get install zip
再看看是否允许?
仍然报同样错。
接着找include/DefaultSettings.php
在'application/zip' 前面加上#
$wgMimeTypeBlacklist= array(
# HTML may contain cookie-stealing JavaScript and web bugs
'text/html', 'text/javascript', 'text/x-javascript', 'application/x-shellscript',
# PHP scripts may execute arbitrary code on the server
'application/x-php', 'text/x-php',
# Other types that may be interpreted by some servers
'text/x-python', 'text/x-perl', 'text/x-bash', 'text/x-sh', 'text/x-csh',
# Client-side hazards on Internet Explorer
'text/scriptlet', 'application/x-msdownload',
# Windows metafile, client-side vulnerability on some systems
'application/x-msmetafile',
# A ZIP file may be a valid Java archive containing an applet which exploits the
# same-origin policy to steal cookies
#'application/zip',
)
又出现新错
Warning: mkdir(): Permission denied in ~wiki/includes/GlobalFunctions.php on line 1943
无法创建目录"public/archive/b/ba"。这绝对是权限的问题
sudo chown -R www-data:www-data images
再测试!!
通过了
Word2MediaWiki.zip (文件大小: 2 KB, MIME 类型: application/zip)
警告: 该文件可能包含恶意代码,运行它可能对您的系统带来危险。
附:参考
apache的MIME类型设置
根据默认,Apache 通过检查文件的扩展名来决定与每个文件一起发送的媒体类型。扩展名类型映射存储于 httpd/conf 目录(通常是类似 /usr/httpd/conf 或 /etc/httpd/conf 的目录)下的 mime.types 文件中。比如,清单 2 显示了 Apache 2.0 的 mime.types 文件的部分内容。
# This file controls what Internet media types are sent to the client for # given file extension(s). Sending the correct media type to the client # is important so they know how to handle the content of the file. # Extra types can either be added here or by using an AddType directive # in your config files. For more information about Internet media types, # please read RFC 2045, 2046, 2047, 2048, and 2077. The Internet media type # registry is at <http://www.iana.org/assignments/media-types/>. # MIME type Extensions application/atom+xml atom application/mathematica application/mathml+xml mathml application/msword doc application/octet-stream bin dms lha lzh exe class so dll dmg application/postscript ai eps ps application/rdf+xml rdf application/reginfo+xml application/xhtml+xml xhtml xht application/xslt+xml xslt application/xml xml xsl application/xml-dtd dtd application/xml-external-parsed-entity application/zip zip audio/mpeg mpga mp2 mp3 image/jpeg jpeg jpg jpe image/naplps image/png png image/svg+xml svg image/tiff tiff tif text/html html htm text/plain asc txt text/sgml sgml sgm text/xml text/xml-external-parsed-entity video/mpeg mpeg mpg mpe
一些更老的版本没有根据默认安装所有这些映射,并且可能事实上使用了一些十分有害的映射。尤其应该注意,对于原始 XML 文件使用 text/xml 而不是 application/xml 是一个常见的问题。
具有了这些默认的映射后,您所需要做的全部工作就是为 XHTML 文件加上 .xhtml 或 .xht 后缀,而不是 .html 后缀,之后,所有这类文件都将被作为 application/xhtml+xml 处理。这对于 Firefox、Opera 和 Safari 效果很好,但对于 Internet Explorer 却并非如此。您所需要的是一种方法,通过它可向 Internet Explorer 发送一种媒体类型而向所有其他浏览器发送另一种媒体类型。
IIS6的MIME类型设置
由于 IIS6 默认没有添加上一些 MIME ,在下载这些文件时会提示找不到文件,所以要手动添加上去,而且还要在IIS中,进入网站的属性,把主目录里面的执行权限设置成纯脚本。
Mime-Types(mime类型) Dateiendung(扩展名) Bedeutung
application/msexcel *.xls *.xla Microsoft Excel Dateien
application/mshelp *.hlp *.chm Microsoft Windows Hilfe Dateien
application/mspowerpoint *.ppt *.ppz *.pps *.pot Microsoft Powerpoint Dateien
application/msword *.doc *.dot Microsoft Word Dateien
application/octet-stream *.exe exe
application/pdf *.pdf Adobe PDF-Dateien
application/postscript *.ai *.eps *.ps Adobe Postscript-Dateien
application/rtf *.rtf Microsoft RTF-Dateien
application/x-httpd-php *.php *.phtml PHP-Dateien
application/x-javascript *.js serverseitige JavaScript-Dateien
application/x-shockwave-flash *.swf *.cab Flash Shockwave-Dateien
application/zip *.zip ZIP-Archivdateien
audio/basic *.au *.snd Sound-Dateien
audio/mpeg *.mp3 MPEG-Dateien
audio/x-midi *.mid *.midi MIDI-Dateien
audio/x-mpeg *.mp2 MPEG-Dateien
audio/x-wav *.wav Wav-Dateien
image/gif *.gif GIF-Dateien
image/jpeg *.jpeg *.jpg *.jpe JPEG-Dateien
image/x-windowdump *.xwd X-Windows Dump
text/css *.css CSS Stylesheet-Dateien
text/html *.htm *.html *.shtml -Dateien
text/javascript *.js JavaScript-Dateien
text/plain *.txt reine Textdateien
video/mpeg *.mpeg *.mpg *.mpe MPEG-Dateien
video/vnd.rn-realvideo *.rmvb realplay-Dateien
video/quicktime *.qt *.mov Quicktime-Dateien
video/vnd.vivo *viv *.vivo Vivo-Dateien