日期:2014-05-17  浏览次数:20758 次

struts2 fileupload 上传问题
struts2上传:
在上传过程中关闭浏览器,
然后再打开浏览器重新上传,上传失败
struts2自动跳转到input  的result
error:Processing of multipart/form-data request failed. Stream ended unexpectedly
请struts2高手解答下原因及处理方法 谢谢。
------最佳解决方案--------------------
那就不知道了
<script>
alert("那就不知道了!!");
<script>
看看你的页面
------其他解决方案--------------------
该回复于2010-12-23 13:56:57被版主删除
------其他解决方案--------------------
该回复于2010-12-23 15:04:21被版主删除
------其他解决方案--------------------
不是吧     应该不会出现这样的问题啊  
我测试过我自己的上传   
上传中间把浏览器关掉   
在重新上传不会出现你那样的问题
给你一段上传代码   你试试

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);