直接上代码,方便以后使用
File localFile = new File("D:\\aa.html");
try (FileInputStream input = new FileInputStream(localFile)) {
MultipartFile file = new MockMultipartFile(localFile.getName(), localFile.getName(), "text/plain", input);
}