zoukankan      html  css  js  c++  java
  • Content type ‘multipart/form-data;boundary=--------------------------9107

    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(“进来了”);
    }

    ————————————————
    版权声明:本文为CSDN博主「进击的呆萌」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
    原文链接:https://blog.csdn.net/qq_15791577/article/details/107639362

  • 相关阅读:
    C++ std::stack 基本用法
    linux6 安装 ntopng
    linux 6安装 redis2.6
    Linux6搭建Tomcat服务器
    EXSI6.5忘记root密码
    python3笔记--数字
    python3笔记--运算符
    python3基本数据类型
    python3笔记
    centos6.X升级python3.X方法
  • 原文地址:https://www.cnblogs.com/dingjiaoyang/p/15211751.html
Copyright © 2011-2022 走看看