mobilefish

Untitled

Nov 18th, 2019
255
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.72 KB | None | 0 0
  1. @PostMapping("/upload")
  2. public String singleFileUpload(@RequestParam("file") MultipartFile file,
  3. RedirectAttributes redirectAttributes) {
  4.  
  5. if (file.isEmpty()) {
  6. LOGGER.info("File is empty");
  7. redirectAttributes.addFlashAttribute("message", "Please select a file to upload");
  8. return "redirect:uploadStatus";
  9. }
  10.  
  11. try {
  12.  
  13. // do some magic
  14.  
  15. redirectAttributes.addFlashAttribute("message",
  16. "data updated successfully...");
  17.  
  18. } catch (IOException e) {
  19. e.printStackTrace();
  20. }
  21.  
  22. return "redirect:uploadStatus";
  23. }
Add Comment
Please, Sign In to add comment