- 测试代码
注意:函数文件参数名必须与上传表单文件name一致
- 代码
① 获取上传文件的名称:getOriginalFilename()
String originalFilename = upload.getOriginalFilename();
② 设置存储路径:transferTo()
upload.transferTo(new File(“D:\upload” + originalFilename));
@RequestMapping(value = “/quick23”)
@ResponseBody
public void save23(String username, MultipartFile upload) throws IOException {
System.out.println(12312312);
// 获得上传文件名称
String originalFilename = upload.getOr