@RequestMapping(value = "/userpic/upload", method = RequestMethod.POST) public String uploadUserPicture( @RequestPart("profilePicture") Part userPicrure, Principal principal) throws IOException { User user = userService.findUser(principal.getName()); userService.uploadPicture(userPicrure, user.getId()); return "redirect:/"; }
@RequestMapping(value = "/userpic/remove", method = RequestMethod.POST) public String removeUserPicture(Principal principal) { User user = userService.findUser(principal.getName()); userService.removePicture(user.getId()); return "redirect:/"; }