PostMapping请求,同时接收实体类、String参数、File文件

报错 415 或 Content type 'multipart/form-data;boundary=--------------------------9107

经过半个小时的查找,
改Content-Type
改传值方式
改@RequestBody 改@Param 改@RequestParam

最后证实,@RequestBody与file的 form-data有冲突,无法识别是表单提交还是json提交

解决办法:
删了@RequestBody! 删了@RequestBody!删了@RequestBody!

@PostMapping("/addFeedbackMain/{type}")
public void addFeedbackMain(FeedbackMain feedbackMain,@PathVariable String type, MultipartFile[] files){
System.out.println(files);
System.out.println(type);
System.out.println(feedbackMain);
System.out.println(“进来了”);
}
Content type ‘multipart/form-data;boundary=--------------------------9107

相关文章:

  • 2022-02-02
  • 2022-12-23
  • 2021-07-23
  • 2022-01-01
  • 2022-12-23
  • 2021-12-10
猜你喜欢
  • 2021-09-19
  • 2022-12-23
  • 2021-10-09
  • 2022-12-23
  • 2021-07-11
  • 2021-05-29
相关资源
相似解决方案