weixin_33724659 2017-08-24 12:28 采纳率: 0%
浏览 50

REST API中的Ajax调用错误

ajax code -

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 : A message body reader for Java class org.springframework.web.multipart.MultipartFile, and Java type interface org.springframework.web.multipart.MultipartFile, and MIME media type multipart/form-data; boundary=----WebKitFormBoundaryG1QTOMPq2FNC5Z1j was not found. The registered message body readers

  • 写回答

0条回答 默认 最新

    报告相同问题?