Ajaxupload and Spring MVC

If you upload a file via a normal form, then it works. If you load the file / files with ajaxupload nothing works.

Error:

org.springframework.web.multipart.MultipartException: The current request is not a multipart request

@ RequestMapping (value = "/ upload", method = RequestMethod.POST) public void upload (@ RequestParam MultipartFile file, HttpServletRequest request, HttpServletResponse response)

Purpose - Multibooting files with ajax, can anyone have a working example for the Spring. I have a separate servlet that receives HttpServletRequest and parses everything is fine. On the client side ajaxupload. If you try a simple Spring MVC transfer request in this class, he refuses to work, arguing that the request is not multipart. Spring is obtained as a sawing the original request?


Please change fileupload.js , search and comment out the line which has "application/octet-stream"

and add following line : xhr.setRequestHeader("Content-Type", "multipart/form-data");

链接地址: http://www.djcxy.com/p/48732.html

上一篇: Intellij IDEA REST客户端文件上传

下一篇: Ajaxupload和Spring MVC