I have a web application with spring in which I do some file upload. Under eclipse, using Jetty (the maven plugin) it works perfectly. But when I deploy the application unde
Thanks to @Bart I was able to find the following simple solution :
In the intercepting method, use @ModelAttribute instead of @RequestParam :
@RequestMapping(value = IMPORT_PAGE, method = RequestMethod.POST)
public String recieveFile(@RequestParam("importType") String importType,
@ModelAttribute("file") UploadedFile uploadedFile, final HttpSession session)
{
MultipartFile multipartFile = uploadedFile.getFile();
Where UploadedFile is the following class :
public class UploadedFile
{
private String type;
private MultipartFile file;
public String getType()
{
return type;
}
public void setType(String type)
{
this.type = type;
}
public void setFile(MultipartFile file)
{
this.file = file;
}
public MultipartFile getFile()
{
return file;
}
}
And it's working !!
Thanks everyone for your help.