I am trying to send a multipart request to the server but i am getting the following exception HTTP Status 500 - Request processing failed; nested exception is org.spring
It seems that your tag form is not well formated and everything that is after the
'action="<c:url value="/members/profileimageupload" />"'
is being ignored. Try to write like this and see if it works:
action="<c:url value='/members/profileimageupload' />"
Check whether you have added CommonsMultipartResolver in Spring-Servlet.xml.
<bean id="multipartResolver" class="org.springframework.web.multipart.commons.CommonsMultipartResolver"/>
Then, add the enctype to multipart/form-data in your form
<form id="fileupload" method="post" enctype="multipart/form-data">
Finally in Controller, Request > MultipartHttpServletRequest
@RequestMapping(value = "/profileimageupload", method = RequestMethod.POST)
public ModelAndView uploadProfileImage(MultipartHttpServletRequest request) {}
Dependencies
- commons-fileupload.jar
- commons-io.jar
Try again with "headers":
@RequestMapping(value = "/profileimageupload", headers = "content-type=multipart/*", method = RequestMethod.POST)
and ajax call follow: How can I upload files asynchronously?
I hope this helpful to you!