MultipartFile转File
File file = new File(path);
FileUtils.copyInputStreamToFile(multipartFile.getInputStream(), file);
File转MultipartFile
File file = new File("src/test/resources/input.txt");
FileInputStream input = new FileInputStream(file);
MultipartFile multipartFile =new MockMultipartFile("file", file.getName(), "text/plain", IOUtils.toByteArray(input));
原文:https://www.cnblogs.com/tyrone-vip/p/12172946.html