新闻发布系统
return file; }
public void setFile(List<File> file) { this.file = file; }
public List<String> getFileFileName() { return fileFileName; }
public void setFileFileName(List<String> fileFileName) { this.fileFileName = fileFileName; }
public List<String> getFileContenType() { return fileContenType; }
public void setFileContenType(List<String> fileContenType) { this.fileContenType = fileContenType; }
@SuppressWarnings("deprecation") @Override
public String execute(){ try{
for(int i = 0;i < file.size();++i){ if(file.get(i).length()!=0){
InputStream is = new FileInputStream(file.get(i)); String root = ServletActionContext.getRequest().getRealPath(this.getSavePath()); File destFile = new File(root,this.getFileFileName().get(i)); String time = new DateFormatEditor().dateEditor2(new Date());
if(uploadManager.savePath(null,this.getFileFileName().get(i), time)){
OutputStream os = new FileOutputStream(destFile);
int length = 0;
byte[] buffer = new byte[400];
while((length = is.read(buffer)) >0){ os.write(buffer, 0, length); }
is.close(); os.close();
ServletActionContext.getRequest().setAttribute("state", "uploadFileSucc");
return SUCCESS;