可能是struts配置文件中定义的拦截器导致的,后缀拦截导致,将该拦截器去掉,在action类里判断后缀

public String upload()throws Exception{
ActionContext ctxActionContext = ActionContext.getContext();
//this.schoolar = this.expertService.findSchoolarByUid(uid) ;
String directory = ServletActionContext.getServletContext()
.getRealPath(savePath);
File file = new File(directory);
String fileTypesString = MessageUtil.get("fileTypes");// 获取属性文件中规定的附件的文件类型
String fileTypes[] = null;
fileTypes = fileTypesString.split(",");// 所有合法的文件类型后缀构成的字符数组

String suffix = null;// 上传的附件的后缀
suffix = this.getUploadFileName().substring(
this.getUploadFileName().lastIndexOf(".") + 1,
this.getUploadFileName().length());
// 循环判断 后缀是否合法
int count = 0;// 计数器
for (int i = 0; i < fileTypes.length; i++) {
if (fileTypes[i].equalsIgnoreCase(suffix)) {
break;
} else {
count++;
}
}
if (count == fileTypes.length) {
ctxActionContext.put("msg", "文件类型不合法,请核对类型!");
return INPUT;
}
//......
}

最新文章

  1. expert C Programing notes
  2. php发送get、post请求的6种方法简明总结
  3. C# List 中 Find 方法
  4. Bzoj 4403: 序列统计 Lucas定理,组合数学,数论
  5. Python学习笔记七-错误和异常
  6. 被FusionCharts V3.4抛弃的东西
  7. Java流机制学习
  8. Java基础学习笔记二十一 多线程
  9. 关于React Native 火热的话题,从入门到原理
  10. 制作CSS绚烂效果的三种属性
  11. cocos2d-js 遮挡层(禁止触摸事件传递层)
  12. 一加3刷不了官方recoery
  13. HTTPS 指南
  14. CSS相对定位|绝对定位(五)之z-index篇——张鑫旭
  15. 机器学习-ID3决策树算法(附matlab/octave代码)
  16. EM算法的思考
  17. jsp的session完成登陆功能
  18. 【vue】vue组件的自定义事件
  19. DOM节点的三个属性
  20. mysql 8.0.12 日常出错

热门文章

  1. Ubuntu安装Flash
  2. The P4 Language Specification v1.0.2 Parser
  3. springMVC框架下——通用接口之图片上传接口
  4. java.util.concurrent.CopyOnWriteArrayList
  5. fatal error C1854: 无法覆盖在创建对象文件.obj”的预编译头过程中形成的信息
  6. Groovy 在eclipse中的使用
  7. 将所有程序设置XML集中到一个单独XML配置文件的方法:使用appSettings元素的configSource元素
  8. Tinyxml的简单应用
  9. IIS出现HTTP500.24错误
  10. Linux centos关机与重启命令详解与实战