<form action= "/bcis/api/headImgUpload.json" method= "post" enctype= "multipart/form-data" > <input type= "file" name= "file" > <input type= "submit" value= "提交" > </form> 2.controller: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 @RequestMapping (value = "/headImgUpload.json" , method = RequestMethod.POST) @ResponseBody public Map<String, Object> headImgUpload(HttpServletRequest request,MultipartFile file) { Map<String, Object> value = new HashMap<String, Object>(); value.put( "success" , true ); value.put( "errorCode" , 0 ); value.put( "errorMsg" , "" ); try { String head = userService