Spring MVC - 上传文件显示客户端发送的请求在语法上不正确

Spring MVC - upload file shows The request sent by the client was syntactically incorrect

当我使用表单提交上传包含其他详细信息的文件时,它显示错误 HTTP Status 400 - 类型状态报告 信息 说明客户端发送的请求语法错误。

jsp 页

         <form:form method="POST" action="addbanners?${_csrf.parameterName}=${_csrf.token}" modelAttribute="banner" enctype="multipart/form-data">
    <h2>New Banner</h2>
    <table>
    <tr><td>Banner Name</td>
    <td><form:input type="text" name="thematicdayid" id="thematicdayid" path="bannerName" /></td></tr>
    <tr><td>Banner Image</td>
    <td><form:input name="uploadBanner" type="file" id="uploadBanner" path="bannerImage"/></td></tr>
    <tr><td> <button type="submit" class="btn btn-success" id="btnAddBanner">Add</button></td></tr>
    </table>
    </form:form>

filecontroller.java

    @RequestMapping(value = "/addbanners", method = RequestMethod.POST)
public ModelAndView addbanners(@ModelAttribute Banner banner,@RequestParam("file") MultipartFile file){

    System.out.println("File"+file);
    ImageUpload imageUpload=new ImageUpload();
    if(!file.isEmpty())
    {
    String path=context.getRealPath("");
    String imagename=imageUpload.uploadImage(file,path);
    banner.setBannerImage(imagename);

    filewriterServices.saveBannerDetails(banner);
    }
    ModelAndView model = new ModelAndView();
    model.setViewName("filepage");
    return model;
}

我在 root-context.xml

中添加了以下详细信息
<beans:bean id="multipartResolver"
    class="org.springframework.web.multipart.commons.CommonsMultipartResolver">
    <beans:property name="maxUploadSize" value="100000" />
</beans:bean> 

改变

public ModelAndView addbanners(@ModelAttribute Banner banner,@RequestParam("file") MultipartFile file)

public ModelAndView addbanners(@ModelAttribute Banner banner,@RequestParam("uploadBanner") MultipartFile file)

我通过更改得到了答案

public ModelAndView addbanners(@ModelAttribute Banner banner,@RequestParam("file") MultipartFile file) to

public ModelAndView addbanners(@ModelAttribute Banner banner,@RequestParam("uploadBanner") MultipartFile file)

并改变

<form:input name="uploadBanner" type="file" id="uploadBanner" path="bannerImage"/> to 
<input name="uploadBanner" type="file" id="uploadBanner" path="bannerImage"/> 

感谢@Akash Rajbanshi 帮助我找出错误。