jsp form中设置了method="post" enctype="multipart/form-data"
上传图片设置了<input type="file" name="upload" />
action文件中有
private File upload;
private String uploadFileName;
private String uploadContentType;
并且设置了get和set方法。
在上传图片代码中
public String execute()
{
destPath = "F:\\eclipse\\workspace\\Ssbxxt\\WebRoot\\upload";
try{
System.out.println("Src File name: " + upload);
System.out.println("Dst File name: " + uploadFileName);
File destFile = new File(destPath, uploadFileName);
FileUtils.copyFile(upload, destFile);
}catch(IOException e){
e.printStackTrace();
return ERROR;
}
return SUCCESS;
}
显示upload,uploadFileName都为空