JSP
<form action="/savFile" method="post" enctype="multipart/form-data">
<input type="file" name="file">
<input type="submit">
</form>
Controller
@ResponseBody
@RequestMapping("/savFile")
public String savFile(MultipartFile file) throws IOException {
//存放路径
String realPath = "E://";
//获取文件名+后缀
String fileName = file.getOriginalFilename();
//保存文件
file.transferTo(new File(realPath + fileName));
return "OK!";
}