I do not know how to catch the file on the rest api controller and what method to send it to Postman, please help me will be very grateful)
Body
Headers
Controller
To post a file through postman you need a method something like :
@PostMapping(path = "/post", consumes = { "multipart/form-data" })
public ResponseEntity<String> uploadFile(@RequestParam(name = "file") MultipartFile file, @RequestParam("message")String message, @RequestParam("subject")Integer subject ){
//You can then get any info about file like :
System.out.println(file.getName());
System.out.println(file.getOriginalName());
System.out.println(file.getContentType());
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.