struts2上传文件类型列表
1 '.a' : 'application/octet-stream', 2 '.ai' : 'application/postscript', 3 '.aif' : 'audio/x-aiff', 4 '.aifc' : 'audio/x-aiff', 5 '.aiff' : 'audio/x-aiff', 6 '.au' : 'audio/basic', 7 '.avi' : 'video/x-msvideo', 8 '.bat' : 'text/plain', 9 '.bcpio' : 'application/x-bcpio', 10 '.bin' : 'application/octet-stream', 11 '.bmp' : 'image/x-ms-bmp', 12 '.c' : 'text/plain', 13 # Duplicates :( 14 '.cdf' : 'application/x-cdf', 15 '.cdf' : 'application/x-netcdf', 16 '.cpio' : 'application/x-cpio', 17 '.csh' : 'application/x-csh', 18 '.css' : 'text/css', 19 '.dll' : 'application/octet-stream', 20 '.doc' : 'application/msword', 21 '.dot' : 'application/msword', 22 '.dvi' : 'application/x-dvi', 23 '.eml' : 'message/rfc822', 24 '.eps' : 'application/postscript', 25 '.etx' : 'text/x-setext', 26 '.exe' : 'application/octet-stream', 27 '.gif' : 'image/gif', 28 '.gtar' : 'application/x-gtar', 29 '.h' : 'text/plain', 30 '.hdf' : 'application/x-hdf', 31 '.htm' : 'text/html', 32 '.html' : 'text/html', 33 '.ief' : 'image/ief', 34 '.jpe' : 'image/jpeg', 35 '.jpeg' : 'image/jpeg', 36 '.jpg' : 'image/jpeg', 37 '.js' : 'application/x-javascript', 38 '.ksh' : 'text/plain', 39 '.latex' : 'application/x-latex', 40 '.m1v' : 'video/mpeg', 41 '.man' : 'application/x-troff-man', 42 '.me' : 'application/x-troff-me', 43 '.mht' : 'message/rfc822', 44 '.mhtml' : 'message/rfc822', 45 '.mif' : 'application/x-mif', 46 '.mov' : 'video/quicktime', 47 '.movie' : 'video/x-sgi-movie', 48 '.mp2' : 'audio/mpeg', 49 '.mp3' : 'audio/mpeg', 50 '.mpa' : 'video/mpeg', 51 '.mpe' : 'video/mpeg', 52 '.mpeg' : 'video/mpeg', 53 '.mpg' : 'video/mpeg', 54 '.ms' : 'application/x-troff-ms', 55 '.nc' : 'application/x-netcdf', 56 '.nws' : 'message/rfc822', 57 '.o' : 'application/octet-stream', 58 '.obj' : 'application/octet-stream', 59 '.oda' : 'application/oda', 60 '.p12' : 'application/x-pkcs12', 61 '.p7c' : 'application/pkcs7-mime', 62 '.pbm' : 'image/x-portable-bitmap', 63 '.pdf' : 'application/pdf', 64 '.pfx' : 'application/x-pkcs12', 65 '.pgm' : 'image/x-portable-graymap', 66 '.pl' : 'text/plain', 67 '.png' : 'image/png', 68 '.pnm' : 'image/x-portable-anymap', 69 '.pot' : 'application/vnd.ms-powerpoint', 70 '.ppa' : 'application/vnd.ms-powerpoint', 71 '.ppm' : 'image/x-portable-pixmap', 72 '.pps' : 'application/vnd.ms-powerpoint', 73 '.ppt' : 'application/vnd.ms-powerpoint', 74 '.ps' : 'application/postscript', 75 '.pwz' : 'application/vnd.ms-powerpoint', 76 '.py' : 'text/x-python', 77 '.pyc' : 'application/x-python-code', 78 '.pyo' : 'application/x-python-code', 79 '.qt' : 'video/quicktime', 80 '.ra' : 'audio/x-pn-realaudio', 81 '.ram' : 'application/x-pn-realaudio', 82 '.ras' : 'image/x-cmu-raster', 83 '.rdf' : 'application/xml', 84 '.rgb' : 'image/x-rgb', 85 '.roff' : 'application/x-troff', 86 '.rtx' : 'text/richtext', 87 '.sgm' : 'text/x-sgml', 88 '.sgml' : 'text/x-sgml', 89 '.sh' : 'application/x-sh', 90 '.shar' : 'application/x-shar', 91 '.snd' : 'audio/basic', 92 '.so' : 'application/octet-stream', 93 '.src' : 'application/x-wais-source', 94 '.sv4cpio': 'application/x-sv4cpio', 95 '.sv4crc' : 'application/x-sv4crc', 96 '.swf' : 'application/x-shockwave-flash', 97 '.t' : 'application/x-troff', 98 '.tar' : 'application/x-tar', 99 '.tcl' : 'application/x-tcl', 100 101 '.tex' : 'application/x-tex', 102 '.texi' : 'application/x-texinfo', 103 '.texinfo': 'application/x-texinfo', 104 '.tif' : 'image/tiff', 105 '.tiff' : 'image/tiff', 106 '.tr' : 'application/x-troff', 107 '.tsv' : 'text/tab-separated-values', 108 '.txt' : 'text/plain', 109 '.ustar' : 'application/x-ustar', 110 '.vcf' : 'text/x-vcard', 111 '.wav' : 'audio/x-wav', 112 '.wiz' : 'application/msword', 113 '.wsdl' : 'application/xml', 114 '.xbm' : 'image/x-xbitmap', 115 '.xlb' : 'application/vnd.ms-excel', 116 # Duplicates :( 117 '.xls' : 'application/excel', 118 '.xls' : 'application/vnd.ms-excel', 119 '.xml' : 'text/xml', 120 '.xpdl' : 'application/xml', 121 '.xpm' : 'image/x-xpixmap', 122 '.xsl' : 'application/xml', 123 '.xwd' : 'image/x-xwindowdump', 124 '.zip' : 'application/zip', 125 126 127 firefox 和 ie 的文件类型区别 128 Java代码 129 firefox image/jpeg image/bmp image/gif image/png 130 131 ie 6 image/pjpeg image/bmp image/gif image/x-png 132 133 ie 7 image/pjpeg image/bmp image/gif image/x-png 134 135 ie 8 image/pjpeg image/bmp image/gif image/x-png 136 137 138 139 140 141 142 143 -------------------------------------------- 144 IE下载Office2007文件时在下载对话框中变成ZIP文件问题的解决 145 146 147 从 IIS或者Tomcat之类的Web服务器通过二进制流下载文件时(比如通过设置Header为Content- disposition:inline),如果被下载的文件是Office2007的dotx,docx,pot等后缀的时候,下载对话框中的图标会变成 ZIP的,相应的文件名也会成为zip为扩展后缀的文件。其实出现这样的情况,是由于IE中对下载文件类型的判断,假如找不到相应后缀的MIME的话,会 自动根据数据流来判断文件的类型,而微软对Office2007的格式做了和以前完全不同的处理。 148 149 150 151 以 前的Office文档是100%的二进制格式。第三方的工具操作起来非常不方便,而 Office2007从整体上都是基于XML格式的,这里并不是说 Office2007文档可以保存成XML格式。而是Office2007默认的文档格式就是XML的(Word的docx、Excel的xlsx等)。 也许有人会感到奇怪,用文本编辑器打开docx后,显示的仍然是二进制格式,并不是什么 XML。其实docx并不是普通的XML格式,当然,也不只是一 个XML文件,docx本质上是一个zip文件,里面有一系列的xml、目录和其他的文件。如果我们将docx改成zip。就可以用winzip等软件将 其解开。 152 153 正是由于这样的原因,当MIME中不存在相对应的Office2007类型的情况下,被自动识别为ZIP文件了。解决的方法很简单,在Server端添加MIME映射就可以了。Tomcat的话,可以在Web.xml中找到< mime-mapping > </ mime-mapping > 这样的定义,按照规则添加就可以了,IIS中按照下面的方法添加(以XML为例): 154 155 1.选择Default Web Site,弹出Properties对话框。 156 2.选择HTTP Headers标签。 157 3.在MIME Map下,单击File Types 标签并选择New Type。 158 4.在Extension 域中键入.xml,在 Content Type 域中键入text/xml, 然后单击OK。 159 至于什么是MIME,一般的人应该都知道,这里简单的解释一下: 160 MIME (Multipurpose Internet Mail Extensions, 多目的Internet邮件扩展)是创建用于电子邮件交换,网络文档,及企业网和Internet上的其他应用程序中的文件格式的规范。每个MIME格式 包含一个MIME内容类型(”MIME type”)和指示存储在这个文件中的数据的子类型。MIME类型和子类型一般以类型/子类型的形式列出。 MIME格式的内容广泛用于网络文档中 161 162 下面收集了大部分文件的扩展名和相应的MIME对应,有需要的可以在列表中找到并添加。 163 164 .asx,video/x-ms-asf 165 .xml,text/xml 166 .tsv,text/tab-separated-values 167 .ra,audio/x-pn-realaudio 168 .sv4crc,application/x-sv4crc 169 .spc,application/x-pkcs7-certificates 170 .pmc,application/x-perfmon 171 .lit,application/x-ms-reader 172 .crd,application/x-mscardfile 173 .isp,application/x-internet-signup 174 .wmlsc,application/vnd.wap.wmlscriptc 175 .vst,application/vnd.visio 176 .xlam,application/vnd.ms-excel.addin.macroEnabled.12 177 .ttf,application/octet-stream 178 .pfm,application/octet-stream 179 .csv,application/octet-stream 180 .aaf,application/octet-stream 181 .one,application/onenote 182 .hta,application/hta 183 .atom,application/atom+xml 184 .323,text/h323 185 .mhtml,message/rfc822 186 .midi,audio/mid 187 .p7r,application/x-pkcs7-certreqresp 188 .mny,application/x-msmoney 189 .clp,application/x-msclip 190 .vsd,application/vnd.visio 191 .lpk,application/octet-stream 192 .bin,application/octet-stream 193 .onetoc,application/onenote 194 .x,application/directx 195 .wvx,video/x-ms-wvx 196 .vcf,text/x-vcard 197 .htc,text/x-component 198 .htt,text/webviewhtml 199 .h,text/plain 200 .mht,message/rfc822 201 .mid,audio/mid 202 .p7b,application/x-pkcs7-certificates 203 .gz,application/x-gzip 204 .dvi,application/x-dvi 205 .cpio,application/x-cpio 206 .vdx,application/vnd.ms-visio.viewer 207 .sldm,application/vnd.ms-powerpoint.slide.macroEnabled.12 208 .xlm,application/vnd.ms-excel 209 .fdf,application/vnd.fdf 210 .setreg,application/set-registration-initiation 211 .eps,application/postscript 212 .p7s,application/pkcs7-signature 213 .toc,application/octet-stream 214 .mdp,application/octet-stream 215 .ics,application/octet-stream 216 .chm,application/octet-stream 217 .asi,application/octet-stream 218 .afm,application/octet-stream 219 .evy,application/envoy 220 .wmp,video/x-ms-wmp 221 .qt,video/quicktime 222 .mpv2,video/mpeg 223 .xslt,text/xml 224 .etx,text/x-setext 225 .cod,image/cis-cod 226 .snd,audio/basic 227 .au,audio/basic 228 .man,application/x-troff-man 229 .qtl,application/x-quicktimeplayer 230 .pmw,application/x-perfmon 231 .class,application/x-java-applet 232 .iii,application/x-iphone 233 .csh,application/x-csh 234 .z,application/x-compress 235 .vtx,application/vnd.visio 236 .vsw,application/vnd.visio 237 .wps,application/vnd.ms-works 238 .potx,application/vnd.openxmlformats-officedocument.presentationml.template 239 .ps,application/postscript 240 .p7c,application/pkcs7-mime 241 .thn,application/octet-stream 242 .mso,application/octet-stream 243 .dot,application/msword 244 .doc,application/msword 245 .sgml,text/sgml 246 .nws,message/rfc822 247 .pbm,image/x-portable-bitmap 248 .ief,image/ief 249 .wav,audio/wav 250 .texi,application/x-texinfo 251 .mvb,application/x-msmediaview 252 .hdf,application/x-hdf 253 .vsx,application/vnd.visio 254 .dotm,application/vnd.ms-word.template.macroEnabled.12 255 .docm,application/vnd.ms-word.document.macroEnabled.12 256 .pptx,application/vnd.openxmlformats-officedocument.presentationml.presentation 257 .psm,application/octet-stream 258 .java,application/octet-stream 259 .eot,application/octet-stream 260 .jar,application/java-archive 261 .mpeg,video/mpeg 262 .xsf,text/xml 263 .map,text/plain 264 .uls,text/iuls 265 .rf,image/vnd.rn-realflash 266 .m3u,audio/x-mpegurl 267 .wma,audio/x-ms-wma 268 .aifc,audio/aiff 269 .mdb,application/x-msaccess 270 .mvc,application/x-miva-compiled 271 .stl,application/vnd.ms-pki.stl 272 .ppsx,application/vnd.openxmlformats-officedocument.presentationml.slideshow 273 .xlsb,application/vnd.ms-excel.sheet.binary.macroEnabled.12 274 .setpay,application/set-payment-initiation 275 .prm,application/octet-stream 276 .mix,application/octet-stream 277 .lzh,application/octet-stream 278 .hhk,application/octet-stream 279 .onepkg,application/onenote 280 .xaf,x-world/x-vrml 281 .flr,x-world/x-vrml 282 .IVF,video/x-ivf 283 .cnf,text/plain 284 .asm,text/plain 285 .tiff,image/tiff 286 .wax,audio/x-ms-wax 287 .ms,application/x-troff-ms 288 .tcl,application/x-tcl 289 .shar,application/x-shar 290 .sh,application/x-sh 291 .nc,application/x-netcdf 292 .hlp,application/winhlp 293 .oda,application/oda 294 .pfb,application/octet-stream 295 .fla,application/octet-stream 296 .wm,video/x-ms-wm 297 .rgb,image/x-rgb 298 .ppm,image/x-portable-pixmap 299 .ram,audio/x-pn-realaudio 300 .sit,application/x-stuffit 301 .dir,application/x-director 302 .mpp,application/vnd.ms-project 303 .xla,application/vnd.ms-excel 304 .ssm,application/streamingmedia 305 .axs,application/olescript 306 .ods,application/oleobject 307 .psp,application/octet-stream 308 .jpb,application/octet-stream 309 .wrz,x-world/x-vrml 310 .m1v,video/mpeg 311 .mno,text/xml 312 .cmx,image/x-cmx 313 .jpeg,image/jpeg 314 .dib,image/bmp 315 .rmi,audio/mid 316 .aiff,audio/aiff 317 .wmd,application/x-ms-wmd 318 .wri,application/x-mswrite 319 .pub,application/x-mspublisher 320 .ins,application/x-internet-signup 321 .wks,application/vnd.ms-works 322 .xls,application/vnd.ms-excel 323 .ai,application/postscript 324 .crl,application/pkix-crl 325 .qxd,application/octet-stream 326 .dwp,application/octet-stream 327 .xof,x-world/x-vrml 328 .wmv,video/x-ms-wmv 329 .nsc,video/x-ms-asf 330 .mpa,video/mpeg 331 .pnm,image/x-portable-anymap 332 .rpm,audio/x-pn-realaudio-plugin 333 .aif,audio/x-aiff 334 .me,application/x-troff-me 335 .pml,application/x-perfmon 336 .trm,application/x-msterminal 337 .m13,application/x-msmediaview 338 .js,application/x-javascript 339 .dxr,application/x-director 340 .potm,application/vnd.ms-powerpoint.template.macroEnabled.12 341 .xltx,application/vnd.openxmlformats-officedocument.spreadsheetml.template 342 .xlt,application/vnd.ms-excel 343 .xlc,application/vnd.ms-excel 344 .p10,application/pkcs10 345 .smi,application/octet-stream 346 .sea,application/octet-stream 347 .hqx,application/mac-binhex40 348 .spl,application/futuresplash 349 .movie,video/x-sgi-movie 350 .lsf,video/x-la-asf 351 .txt,text/plain 352 .jfif,image/pjpeg 353 .jpe,image/jpeg 354 .zip,application/x-zip-compressed 355 .wmf,application/x-msmetafile 356 .m14,application/x-msmediaview 357 .latex,application/x-latex 358 .wcm,application/vnd.ms-works 359 .pptm,application/vnd.ms-powerpoint.presentation.macroEnabled.12 360 .xlsx,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet 361 .hhp,application/octet-stream 362 .aca,application/octet-stream 363 .accdb,application/msaccess 364 .jcz,application/liquidmotion 365 .wrl,x-world/x-vrml 366 .wmx,video/x-ms-wmx 367 .asr,video/x-ms-asf 368 .lsx,video/x-la-asf 369 .xsl,text/xml 370 .html,text/html 371 .tif,image/tiff 372 .der,application/x-x509-ca-cert 373 .pfx,application/x-pkcs12 374 .p12,application/x-pkcs12 375 .ppsm,application/vnd.ms-powerpoint.slideshow.macroEnabled.12 376 .cur,application/octet-stream 377 .accdt,application/msaccess 378 .hdml,text/x-hdml 379 .htm,text/html 380 .xbm,image/x-xbitmap 381 .jpg,image/jpeg 382 .texinfo,application/x-texinfo 383 .ppam,application/vnd.ms-powerpoint.addin.macroEnabled.12 384 .xlw,application/vnd.ms-excel 385 .rm,application/vnd.rn-realmedia 386 .pdf,application/pdf 387 .rar,application/octet-stream 388 .psd,application/octet-stream 389 .inf,application/octet-stream 390 .emz,application/octet-stream 391 .dsp,application/octet-stream 392 .onea,application/onenote 393 .jck,application/liquidmotion 394 .mpe,video/mpeg 395 .mp2,video/mpeg 396 .sct,text/scriptlet 397 .ras,image/x-cmu-raster 398 .swf,application/x-shockwave-flash 399 .wmz,application/x-ms-wmz 400 .gtar,application/x-gtar 401 .dcr,application/x-director 402 .sldx,application/vnd.openxmlformats-officedocument.presentationml.slide 403 .pps,application/vnd.ms-pps 404 .p7m,application/pkcs7-mime 405 .xsn,application/octet-stream 406 .ocx,application/octet-stream 407 .accde,application/msaccess 408 .mov,video/quicktime 409 .wmls,text/vnd.wap.wmlscript 410 .cpp,text/plain 411 .c,text/plain 412 .bas,text/plain 413 .css,text/css 414 .art,image/x-jg 415 .mp3,audio/mpeg 416 .t,application/x-troff 417 .roff,application/x-troff 418 .tar,application/x-tar 419 .hhc,application/x-oleobject 420 .scd,application/x-msschedule 421 .pko,application/vnd.ms-pki.pko 422 .sst,application/vnd.ms-pki.certstore 423 .ppt,application/vnd.ms-powerpoint 424 .xtp,application/octet-stream 425 .u32,application/octet-stream 426 .pcx,application/octet-stream 427 .msi,application/octet-stream 428 .exe,application/octet-stream 429 .asd,application/octet-stream 430 .onetoc2,application/onenote 431 .fif,application/fractals 432 .mpg,video/mpeg 433 .vml,text/xml 434 .xdr,text/plain 435 .vcs,text/plain 436 .hxt,text/html 437 .eml,message/rfc822 438 .xpm,image/x-xpixmap 439 .ico,image/x-icon 440 .gif,image/gif 441 .dwf,drawing/x-dwf 442 .src,application/x-wais-source 443 .tr,application/x-troff 444 .pmr,application/x-perfmon 445 .pma,application/x-perfmon 446 .dll,application/x-msdownload 447 .bcpio,application/x-bcpio 448 .wmlc,application/vnd.wap.wmlc 449 .wdb,application/vnd.ms-works 450 .dotx,application/vnd.openxmlformats-officedocument.wordprocessingml.template 451 .docx,application/vnd.openxmlformats-officedocument.wordprocessingml.document 452 .pot,application/vnd.ms-powerpoint 453 .xltm,application/vnd.ms-excel.template.macroEnabled.12 454 .rtf,application/rtf 455 .prf,application/pics-rules 456 .snp,application/octet-stream 457 .cab,application/octet-stream 458 .avi,video/x-msvideo 459 .asf,video/x-ms-asf 460 .dtd,text/xml 461 .wml,text/vnd.wap.wml 462 .vbs,text/vbscript 463 .rtx,text/richtext 464 .dlm,text/dlm 465 .xwd,image/x-xwindowdump 466 .pgm,image/x-portable-graymap 467 .bmp,image/bmp 468 .crt,application/x-x509-ca-cert 469 .ustar,application/x-ustar 470 .tex,application/x-tex 471 .sv4cpio,application/x-sv4cpio 472 .tgz,application/x-compressed 473 .cdf,application/x-cdf 474 .vss,application/vnd.visio 475 .cat,application/vnd.ms-pki.seccat 476 .thmx,application/vnd.ms-officetheme 477 .xlsm,application/vnd.ms-excel.sheet.macroEnabled.12 478 .prx,application/octet-stream 479 .pcz,application/octet-stream 480 .onetmp,application/onenote 481 .acx,application/internet-property-stream 482 .wsdl,text/xml 483 .disco,text/xml 484 .xsd,text/xml 485 .wbmp,image/vnd.wap.wbmp 486 .png,image/png 487 .pnz,image/png 488 .smd,audio/x-smd 489 .smz,audio/x-smd 490 .smx,audio/x-smd
2017-08-0815:15:06
请留下你的足迹...