struts2上传:
在上传过程中关闭浏览器,
然后再打开浏览器重新上传,上传失败
struts2自动跳转到input 的result
error:Processing of multipart/form-data request failed. Stream ended unexpectedly
请struts2高手解答下原因及处理方法 谢谢。
在上传过程中关闭浏览器,
然后再打开浏览器重新上传,上传失败
struts2自动跳转到input 的result
error:Processing of multipart/form-data request failed. Stream ended unexpectedly
请struts2高手解答下原因及处理方法 谢谢。
解决方案 »
- spring+hibernate整合出现缺少类。
- 关于JAVA IO流的问题!急!
- Tomcat 中连接数据库很慢,是怎么回事呢?
- 做一个简单的 portlet 都需要什么。
- 关于Tomcat5.0 + sql server 2000的问题
- 一个关于分页的问题,在线等,谢谢
- struts2里有关<s:autocompleter>标签的两个小问题,望高手指教
- servlet同时传俩个值怎么传
- 大家救命啊,关于Cookie的保存时间问题,高分!
- 如何在JSP中配合JS的window.confirm(),实现对系统的灵活控制
- index.jsp通过模拟action接口 转发 到login.jsp页面后,页面背景无法显示
- 帮助改一段话,谢谢
我测试过我自己的上传
上传中间把浏览器关掉
在重新上传不会出现你那样的问题
给你一段上传代码 你试试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);
} catch (FileNotFoundException e) {
e.printStackTrace();
}
FileInputStream fis = null;
try {
fis = new FileInputStream(getUpload());
} catch (FileNotFoundException e) {
e.printStackTrace();
}
byte[] buffer = new byte[1024];
int len = 0;
try {
while ((len = fis.read(buffer)) > 0) {
fos.write(buffer, 0, len);
}
} catch (IOException e) {
e.printStackTrace();
}
try {
fos.flush();
fos.close();
fis.close();
} catch (IOException e) {
e.printStackTrace();
}
System.out.println("导入完成");
return SUCCESS;
}
50多M 哪有那么快啊
第二个文件是完全上传完了的
没有一点问题
你的fileupload是什么版本的
<script>
alert("那就不知道了!!");
<script>
看看你的页面
终于找到问题了,我的action是用spring管理的,就出现了这个问题,
把spring管理去掉就好用了,但具体原因还没搞清楚。