您的位置:首页 > 理论基础 > 计算机网络

uploadify httpError404错误

2015-06-29 22:01 387 查看
1.我使用springmvc+uploadify做文件上传,文件上传后页面报Upload Error: 404,但是文件实际上已经上传成功了。可为什么还是404呢?
网上说要绝对路径,但是我写了也没用。这是upload_url: "fileUpdload_uploadFile"。使用debug模式的时候最后显示 uploadError: HTTP ERROR : File ID: SWFUpload_0_1. HTTP Status: 404.

郁闷了一天,网上找各种解决办法都没搞定。 经过测试,用uploadify返回结果要有
// response.getWriter().write(result);      直接返回流结果。 
 @RequestMapping(value = "/shop/upload",method=RequestMethod.POST)
        public void uploadHandlerForUploadify(HttpServletResponse response,String picHref,HttpServletRequest request)
                throws Exception {
         
            Gson gson = new Gson();  
            String result = gson.toJson(uploadFile);
            String msg = "true";  
            response.getWriter().write(result);   
        //  return result;
      }

//如果发货改为。就会出现文件上传成确一直提示Upload Error: 404错误。猜测是uploadify 成功回调函数不能识别响应报文头contentType: application/json;charset=UTF-8为json的标示。
因为uploadify提交的时候没有指定返回数据类型
 @RequestMapping(value = "/shop/upload",method=RequestMethod.POST)
        public stringuploadHandlerForUploadify(HttpServletResponse response,String picHref,HttpServletRequest request)
                throws Exception {
         
            Gson gson = new Gson();  
            String result = gson.toJson(uploadFile);
            
            return result;
      }
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: