Last active
October 10, 2016 18:45
-
-
Save wangyangcx/7209335 to your computer and use it in GitHub Desktop.
extjs file upload & spring mvc
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @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); | |
| } |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
extjs上传,response不支持applacation/json,需要设置为text/html。