rdm
rdm

Reputation: 330

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

Code:

@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?

Upvotes: 3

Views: 900

Answers (1)

NoodleX
NoodleX

Reputation: 749

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");

Upvotes: 0

Related Questions