休息api中的Ajax调用错误

时间:2017-08-24 12:28:55

标签: ajax spring-mvc

  

ajax代码 -

var formData = new FormData();

            formData.append('name', "DOG");
            // ... 
            formData.append('file',file[0]);
          //  contentType: 'multipart/**',

            $.ajax({
                type: "POST",
                url: "rest/user/upload",
                data: formData,
                processData: false,
                contentType: false,
                enctype: 'multipart/form-data',
                success: function(response) {
                    console.log(response);
                },
                error: function(errResponse) {
                    console.log(errResponse);
                }
            });

SPRING ERROR: Java类org.springframework.web.multipart.MultipartFile和Java类型接口org.springframework.web.multipart.MultipartFile的消息体阅读器,以及MIME媒体类型multipart / form-data; boundary = ----找不到WebKitFormBoundaryG1QTOMPq2FNC5Z1j。已注册的邮件正文读者

0 个答案:

没有答案