Advertisement
Guest User

Untitled

a guest
Feb 7th, 2021
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.66 KB | None | 0 0
  1. package me.danya.springtest
  2.  
  3. import org.springframework.stereotype.Controller;
  4. import org.springframework.web.bind.annotation.GetMapping;
  5. import org.springframework.web.bind.annotation.PostMapping;
  6. import org.springframework.web.bind.annotation.RequestParam;
  7.  
  8. import java.io.File;
  9.  
  10. @Controller
  11. public class FileUploadController {
  12.  
  13.     @GetMapping("uploadfile")
  14.     public String getMappingAdminPage() {
  15.         return "uploadfile";
  16.     }
  17.  
  18.     @PostMapping("uploadfile")
  19.     public String uploadTasks(@RequestParam("file") File file) {
  20.         System.out.println(file.getName() + "\n" + file.getAbsolutePath());
  21.         return "uploadfile";
  22.  
  23.     }
  24.  
  25. }
  26.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement