日期:2014-05-17 浏览次数:20809 次
private File upload;// 封装上传文件
private String uploadFileName;// 设置上传文件的文件名
private String uploadContentType;// 上传文件的类型
public File getUpload() {
return upload;
}
public void setUpload(File upload) {
this.upload = upload;
}
public String getUploadFileName() {
return uploadFileName;
}
public void setUploadFileName(String uploadFileName) {
this.uploadFileName = uploadFileName;
}
public String getUploadContentType() {
return uploadContentType;
}
public void setUploadContentType(String uploadContentType) {
this.uploadContentType = uploadContentType;
}
/**
* xml文件上传
*
* @return
* @throws Exception
*/
public String xmlUpload() {
if (this.getUpload() == null) {
this.addActionError("不允许上传空文件,请您重新上传!");
return "commonPage";
}
FileOutputStream fos = null;
String basePathfile = 你要上传的文件路径 + getUploadFileName();
try {
fos = new FileOutputStream(basePathfile);