日期:2014-05-20  浏览次数:20752 次

struts2文件上传不上去
action的changePhoto()函数处理文件上传,其中savePath已经在struts.xml中指定好了
public String changePhoto()throws Exception{
FileInputStream is = new FileInputStream(file);
File destFile = new File(savePath,fileFileName);
FileOutputStream os = new FileOutputStream(destFile);
byte[] buffer = new byte[1024];
int length = 0;
while((length = is.read(buffer)) > 0){
os.write(buffer,0,length);
}
is.close();
os.close();
return SUCCESS;
}
前台也设置取得上传文件的文件名和类型
<s:property value = "fileFileName"/>
<s:property value = "fileContentType"/>
当我运行程序时后台没有报错 前台也正确取得了上传文件的文件名和类型
但是在指定的文件夹里却找不到我上传的文件 这是怎么回事

------解决方案--------------------
那就去结贴吧