多文件上传

来源:互联网 发布:windows xp摄像头驱动 编辑:程序博客网 时间:2024/04/30 13:09
 public String execute() throws Exception{  
  •         String realpath = ServletActionContext.getServletContext().getRealPath("/images");  
  •         if(image!=null){  
  •             File savedir = new File(realpath);  
  •             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);  
  •             }  
  •             ActionContext.getContext().put("message""上传成功");  
  •         }  
  •         return "success";  
  •     }