这是我的jQuery代码片段
$("#uploadForm").submit(function (e) {
$.ajax({
url: 'uploadExcel',
data: $('#uploadForm').serialize(),
cache: false,
contentType: 'multipart/form-data',
processData: false,
type: 'POST',
success: function (data) {
alert(data);
}
});
上传文件时出现以下错误:
org.apache.commons.fileupload.FileUploadException: the request was rejected because no multipart boundary was found
at org.apache.commons.fileupload.FileUploadBase$FileItemIteratorImpl.<init>(FileUploadBase.java:931)
at org.apache.commons.fileupload.FileUploadBase.getItemIterator(FileUploadBase.java:331)
at org.apache.commons.fileupload.FileUploadBase.parseRequest(FileUploadBase.java:349)
at org.apache.commons.fileupload.servlet.ServletFileUpload.parseRequest(ServletFileUpload.java:126)
at com.obs.controller.ExcelUploadController.doPost(ExcelUploadController.java:36)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:641)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
原因是什么?如何克服?