Skip to content

Instantly share code, notes, and snippets.

@wangyangcx
Last active October 10, 2016 18:45
Show Gist options
  • Select an option

  • Save wangyangcx/7209335 to your computer and use it in GitHub Desktop.

Select an option

Save wangyangcx/7209335 to your computer and use it in GitHub Desktop.
extjs file upload & spring mvc
@RequestMapping(value = "/upload", method = RequestMethod.POST, produces = MediaType.TEXT_HTML_VALUE)
@ResponseBody
public String upload(@RequestParam("file") MultipartFile file, String name, String message) throws Exception
{
Map<String, Object> resp = Maps.newHashMap();
FileCopyUtils.copy(file.getBytes(), new File('filename'));
resp.put("success", true);
resp.put("msg", "upload success.");
return JSONObject.toJSONString(resp);
}
@wangyangcx
Copy link
Author

extjs上传,response不支持applacation/json,需要设置为text/html。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment