[英]how to catch a file on the rest api controller and what method to send it with Postman
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) 我不知道如何在其余的api控制器上捕获文件以及将它发送给Postman的方法,请帮助我将非常感激)
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());
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.