Jquery ajax post请求内容类型

Jquery ajax post请求内容类型,jquery,ajax,multipartform-data,spring-rest,Jquery,Ajax,Multipartform Data,Spring Rest,我创建了一个包含多部分的html表单,我应该使用表单字段和上传的文件来形成一个请求。我使用了ajax POST请求,但我不知道应该使用哪种contentType。尝试使用“多部分/表单数据”,但我从服务器收到错误请求 var fd = new FormData(); fd.append('name',"somename"); fd.append('regionalName',"newString"); fd.append('cons

我创建了一个包含多部分的html表单,我应该使用表单字段和上传的文件来形成一个请求。我使用了ajax POST请求,但我不知道应该使用哪种contentType。尝试使用“多部分/表单数据”,但我从服务器收到错误请求

        var fd = new FormData();
        fd.append('name',"somename");
        fd.append('regionalName',"newString");
        fd.append('constituencyNumber',122);
        fd.append('districtId',21);
        fd.append('file',document.getElementById('filePicker').files[0]);

        ajax({
           url: "http://192.168.1.157:8080/constituency",
           type: "POST",
           data:fd,
           contentType: false,
           processData: false,
           cache: false,
           success: function () {
               console.log("success");
           },
           error: function () {
               console.log("filaed");
           }
        });
在服务器端

@RequestMapping(value="/constituency", method=RequestMethod.POST)
    public BaseResponseDto addConstituency(@RequestBody FormDataMultiPart constituencyDto){
        log.info("addConstituency");
        return constituencyService.addConstituency(constituencyDto);
    }

请求未到达我的控制器。我错过了什么

尝试使用注释输出
filePicker
append
@ParthTrivedi我尝试过,在ajax调用中尝试使用url“/comment”的此值可能会导致路由问题。您有这些设置吗?php选项:post\u max\u size、upload\u max\u filesize、max\u input\u time