這裏上傳的文件是我的jQuery片段「沒有多邊界發現」異常而使用jQuery的Ajax
$("#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)
的原因是什麼?如何克服?