struts2多文件上传
来源:互联网 发布:java项目成果怎么写 编辑:程序博客网 时间:2024/05/22 09:39
import java.io.File; import org.apache.commons.io.FileUtils; import org.apache.struts2.ServletActionContext; public class FileUpload { private File[] image;//获取上传文件 private String[] imageFileName;//获取上传文件名称 private String[] imageContentType;//获取上传文件类型 public String upload() throws Exception{ String path = ServletActionContext.getServletContext().getRealPath("/upload"); System.out.println(path); if(image != null){ File savedir = new File(path); if(!savedir.exists()) savedir.mkdirs(); for(int i = 0; i < image.length; i++){ File saveFile = new File(savedir,imageFileName[i]); FileUtils.copyFile(image[i], saveFile); } } return "success"; } }
<form action="${pageContext.request.contextPath }/fileupload_upload.action" enctype="multipart/form-data" method="post"> 选择文件1:<input type="file" name="image"> 选择文件2:<input type="file" name="image"> 选择文件3:<input type="file" name="image"> <input type="submit" value="上传"> </form>
0 0
- Struts2多文件上传
- struts2多文件上传
- struts2多文件上传
- struts2 多文件上传
- struts2多文件上传
- struts2多文件上传
- struts2多文件上传
- struts2多文件上传
- Struts2多文件上传
- Struts2多文件上传
- Struts2 多文件上传
- struts2多文件上传
- struts2 多文件上传
- Struts2多文件上传
- struts2多文件上传
- struts2 多文件上传
- struts2多文件上传
- struts2多文件上传
- linux内核异常分析
- 面向对象数据库
- There is no statement named XXX in this SqlMap
- ac自动机(dp)<AC自动机模板> ---高精度处理
- Java SE 8 Lambda 特性与基本原理
- struts2多文件上传
- 计算机中有无符号数的表示方法
- 面向对象数据库模式演进
- 短距离无线通信的方案与选择
- Diagnosing and Resolving Error ORA-04031 on the Shared Pool or Other Memory Pools (文档 ID 146599.1)
- 刚毕业几年,不要太在意得失-
- java 发送邮件 email相关操作代码测试,生成复杂格式邮件,发送邮件相关操作
- Python scikit-learn HMM 存在问题的解决方法
- Linux环境中使用CodeBlocks编译Makefile工程