环境:springBoot开发

controller路径参数设置如下:

@RequestMapping(value = "/insert")
public R insert(
        @RequestParam("name") String name,
        @RequestParam("ticketType") String ticketType,
        @RequestParam("templateType") String templateType,
        @RequestParam("file") MultipartFile multipartFile,//接受的文件
        @RequestParam(value = "remark", required = false) String remark
) {

 

我并没有使用@RequestBody,不知道是什么原因(按照国际惯例应该是可以的!!!)

postman设置:

springboot开发使用postman同时上传文件和数据(文件)

springboot开发使用postman同时上传文件和数据(文件)

springboot开发使用postman同时上传文件和数据(文件)就ok了:下图是debug图

springboot开发使用postman同时上传文件和数据(文件)

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-08-02
  • 2022-12-23
  • 2021-12-24
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-04-18
  • 2022-12-23
  • 2021-11-03
  • 2021-04-21
  • 2021-10-27
相关资源
相似解决方案