多文件上传,只需要将页面修改为多个文件上传项,将方法参数MultipartFile类型修改为MultipartFile[]即可
<form action="${pageContext.request.contextPath}/user/quick23" method="post" enctype="multipart/form-data">名称<input type="text" name="username"><br/>文件1<input type="file" name="uploadFile"><br/>文件2<input type="file" name="uploadFile"><br/><input type="submit" value="提交"></form>
@RequestMapping(value="/quick23")@ResponseBodypublic void save23(String username, MultipartFile[] uploadFile) throws IOException {System.out.println(username);for (MultipartFile multipartFile : uploadFile) {String originalFilename = multipartFile.getOriginalFilename();multipartFile.transferTo(new File("C:\\upload\\"+originalFilename));}}