If you are struggling make file uploading in your spring application, most of the time this may be the cause. We always forgot small things when we configure and setup our project.
Add below code in your application context xml file. This will do the magic you want
<bean id="multipartResolver" class="org.springframework.web.multipart.commons.CommonsMultipartResolver" />
Now you can use CommonsMultipartFile in your controller just like below,
@RequestMapping(value="userprofile", method=RequestMethod.POST)
public String getUserProfile(@RequestParam("inputProfilePic") @Null CommonsMultipartFile profilePicture, HttpServletRequest request){
return "profilepage";
}
That’s all, Enjoy file uploading.
Thanks