Skip to content

Instantly share code, notes, and snippets.

@criminy
Created July 20, 2011 13:30
Show Gist options
  • Save criminy/1094950 to your computer and use it in GitHub Desktop.
Save criminy/1094950 to your computer and use it in GitHub Desktop.
Spring 3 multiple file upload
@Controller
@RequestMapping(value="/")
public class MultipleFileUploadExample
{
Logger log = Logger.getLogger(NewController.class);
@RequestMapping(method=RequestMethod.POST)
public String onMultipleFiles(MultipartHttpServletRequest request)
{
final Map<String,MultipartFile> files = request.getFileMap();
for(Entry<String,MultipartFile> e : files.entrySet())
{
log.debug(e.getKey() + " " + e.getValue().getOriginalFilename());
}
return "redirect:/";
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment