巴巴运动网学习笔记(46-50)
2012-04-10 17:10
330 查看
实现文件上传模块
1.完成文件上传模块的实体bean和业务bean()
View Code
5.修改文件上传成功之后的消息页面(文件上传成功之后采用跳转的方式跳转到其他页面)
1.完成文件上传模块的实体bean和业务bean()
View Code
private static Properties pro = new Properties(); static{ try { pro.load(BaseForm.class.getClassLoader().getResourceAsStream("validateType.properties")); } catch (IOException e) { e.printStackTrace(); } } /** * 验证文件格式是否合法 * @param image * @return */ public boolean isFileTypeValidate(FormFile file){ if(file!=null&&file.getFileSize()>0){ String ext = file.getFileName().substring(file.getFileName().lastIndexOf('.')+1); List<String> allowType = new ArrayList<String>(); for(Object key : pro.keySet()){ String value = (String)pro.get(key); String[] valueArr = value.split(","); for(int i=0;i<valueArr.length;i++){ allowType.add(valueArr[i]); } } return allowType.contains(file.getContentType())&&pro.keySet().contains(ext); } return false; }
5.修改文件上传成功之后的消息页面(文件上传成功之后采用跳转的方式跳转到其他页面)
相关文章推荐
- ASP.NET 3.5核心编程学习笔记(46):HTTP模块的编写
- ES权威指南[官方文档学习笔记]-46 Retrieving a document
- 巴巴运动网学习笔记(61-65)
- 巴巴运动网学习笔记(86-90)
- CUBRID学习笔记 46 PREPARED set Do
- Foundations of Qt Development 学习笔记 Part1 Tips1-50
- 【Java学习笔记】46:鼠标监听做动态分区分配的FF/BF/WF算法演示
- SQLi-Labs 学习笔记(Less 41-50)
- (46)Java学习笔记——多线程 / 线程的生命周期
- IOS学习笔记50--多线程之NSOperation
- SQL Server 2012笔记分享-46:如何快速学习T-SQL语句
- 巴巴运动网学习笔记(31-35)
- 传智播客Hibernate视频教程学习笔记50
- ASP.NET 3.5核心编程学习笔记(50):ASP.NET的安全性之Membership与角色管理
- 考研数学笔记46~50
- Java学习笔记(46)------------知识学习宝库!
- C++ Primer 学习笔记_46_STL实践与分析(20)--容器特有的算法
- iPhone开发学习笔记[4/50]-表视图的使用
- JAVA学习笔记46——其他容器简介3:guava只读控制+函数式编程+集合操作
- Java学习笔记46(多线程三:线程之间的通信)