简体   繁体   English

如何捕获其余api控制器上的文件以及使用Postman发送它的方法

[英]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.

相关问题 rest api - 如何在rest api调用中发送邮递员的身体参数 - rest api - how to send body parameters of postman in rest api call 如何在rest控制器spring boot中为邮递员生成api-key - how to generate api-key for postman in rest controller spring boot 如何将时间和日期值从邮递员发送到我的 REST API - How to send Time and Date value from Postman to my REST API 如何使用邮递员测试提供 .zip 文件的 REST API? - How to test REST API which serve a .zip file using postman? 如何使用邮递员调用REST API进行Azure文件存储? - How to call REST API for azure file storage using postman? 如何在POST方法的REST API中发送日期 - How to send Date in REST API in POST method 如何使用邮递员休息客户端发送对象以调用REST服务,以便它将使用适当的方法参数命中以下给定的方法? - how to send object using postman rest client to call REST service so that it will hit the below given method with proper method parameters? 如何使用邮递员休息客户端将邮递请求发送到以下邮递方法 - How to send post request to the below post method using postman rest client 如何在 Z03D476861AFD3841110F2CB80CCFA8 中请求 Rest API eclipse 服务? - How to request Rest API eclipse service in postman? 如何使用邮递员休息客户端发送对象以调用REST服务 - how to send object using postman rest client to call REST service
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM