Exemplo n.º 1
0
 @RequestMapping(value = "/upload_picture_to_profile", method = RequestMethod.POST)
 public String uploadPicture(MultipartHttpServletRequest request) {
   String currentUsername = request.getUserPrincipal().getName();
   User loggedInUser = userDao.getUserByUsername(currentUsername);
   MultipartFile pic = request.getFile("pic");
   System.out.println("Uploaded: " + pic);
   pictureDao.uploadPicture(pic, loggedInUser.getUserID(), true);
   activityDao.logActivity("Uploaded picture for profile", loggedInUser.getUserID());
   return "redirect:/profile";
 }
Exemplo n.º 2
0
 @RequestMapping(value = "/upload_picture_for_patient/{patientID}", method = RequestMethod.POST)
 public String uploadPicture(
     @PathVariable("patientID") int id, MultipartHttpServletRequest request) {
   String currentUsername = request.getUserPrincipal().getName();
   User loggedInUser = userDao.getUserByUsername(currentUsername);
   MultipartFile pic = request.getFile("pic");
   System.out.println("Uploaded: " + pic);
   Patient p = patientDao.getPatientByID(id);
   pictureDao.uploadPicture(pic, id, false);
   activityDao.logActivity("Uploaded picture for " + p.getDisplayName(), loggedInUser.getUserID());
   return "redirect:/patient/" + id;
 }