struts2 上传2007直接被过滤掉 ----FileUploadInterceptor:56: Content-Type not allowed:
来源:互联网 发布:java扑克牌比大小 编辑:程序博客网 时间:2024/05/29 14:02
先说下一开始遇到的问题:最近公司在做项目整合,代码合并后发现struts2的上传死活不行,当时愁死了,代码一样的,为什么啊这是,
结果冷静下来从根源上查找发现拦截器
于是去合并的工程中搜索,这个拦截器,果然发现问题,在合并的时候他们吧struts.xml中添加了两个同名的拦截器,檫,这想玩死我啊!后来总算搞懂,说他们合并工程的时候并没有好好的仔细的去审核。
各种操蛋啊!MD想骂人!浏览器真TM坑人!
我打算上传一个office2007的类型excel:经过查询他对应的类型应该是:application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,
于是加上了,ie和chrom流量器没有问题。
fuck 他大爷的火狐,死活不行,结果就在快奔溃的时候发现了她的提示
FileUploadInterceptor:56: Content-Type not allowed: importExcel "mould.xlsx" "upload_63775352_1e01_4c16_ae64_2bf5dd82eb05_00000000.tmp" application/x-download
我去,application/x-download这也是一种类型?为什么是download这和下载有什么关系。檫
struts.xml配置这样的类型后果然通过了,我真心想骂街,究竟什么情况?
下面给大家看看代码
页面:
下面看三个浏览器效果:
实在不行,所以不用他了,直接用js检查,上传文件的后缀好了
function validataExts(sender){
var extend = sender.value;
extend = extend.substring(extend.lastIndexOf("."));
if(extend==".xlsx"){
return true;
}else{
alert('请使用模板文件上传!');
return false;
}
}
function file_change(sender) {
var result = validataExts(sender);
// document.f_form.submit();
if(result){
$("#f_form").submit();//通过了才让提交
}
}
=========================================================================================
问题总算解决了,很苦痛的过程!不过这也是经验
- struts2 上传2007直接被过滤掉 ----FileUploadInterceptor:56: Content-Type not allowed:
- struts2 jpg文件上传失败 Content-Type not allowed
- struts2文件上传失败 Content-Type not allowed
- Content-Type not allowed ** image/x-png
- Struts2文件上传 深入FileUploadInterceptor
- Android AsyncHttpClient 下载文件 Content-Type not allowed! 错误
- Struts2文件上传(二) 深入FileUploadInterceptor
- Struts2文件上传(二) 深入FileUploadInterceptor
- Struts2文件上传(二) 深入FileUploadInterceptor
- Struts2文件上传(二) 深入FileUploadInterceptor
- Request header field Content-Type is not allowed by Access-Control-Allow-Headers跨域
- 使用AsyncHttpClient下载图片出现org.apache.http.client.HttpResponseException: Content-Type not allowed!
- vue-resource Content-Type is not allowed by Access-Control-Allow-Headers in preflight response
- Request header field Content-Type is not allowed by Access-Control-Allow-Headers跨域
- Request header field Content-Type is not allowed by Access-Control-Allow-Headers in preflight respon
- incomplete type is not allowed
- Content is not allowed in prolog
- Content is not allowed in trailing section
- sigar监控
- [转载 from 子清行]求质数 之 除余法(C语言描述)
- Jquery What’s $, anyway?
- CxImage使用心得
- POJ 1273 Drainage Ditches(EK) - from lanshui_Yang
- struts2 上传2007直接被过滤掉 ----FileUploadInterceptor:56: Content-Type not allowed:
- 新浪微博分享功能,SSO授权完成后又弹出OAuth2.0授权页面的问题
- 第一章总结
- 递归 加引用 实现tree 和 无限级菜单
- 日志太大重命名一下。movefile()
- 用 vmlinuz 得到 vmlinux 逆转化
- 130829大对象
- 数据收集项目总结
- 简单登陆页