Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @PostMapping("/upload")
- public String singleFileUpload(@RequestParam("file") MultipartFile file,
- RedirectAttributes redirectAttributes) {
- if (file.isEmpty()) {
- LOGGER.info("File is empty");
- redirectAttributes.addFlashAttribute("message", "Please select a file to upload");
- return "redirect:uploadStatus";
- }
- try {
- // do some magic
- redirectAttributes.addFlashAttribute("message",
- "data updated successfully...");
- } catch (IOException e) {
- e.printStackTrace();
- }
- return "redirect:uploadStatus";
- }
Add Comment
Please, Sign In to add comment