特殊情况下需要做转换

1、M转F

File file = new File(path); 

FileUtils.copyInputStreamToFile(multipartFile.getInputStream(), file);  

2、F转M

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));

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-12-09
  • 2023-03-20
  • 2021-08-07
  • 2022-01-24
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-03-08
  • 2022-12-23
  • 2021-10-12
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案