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; }
uploadify httpError404错误
最新推荐文章于 2023-08-15 20:45:26 发布