byte[]转MultipartFile

  • pom
<dependency>
    <groupId>org.springframework</groupId>
    <artifactId>spring-test</artifactId>
    <version>5.3.6</version>
</dependency>
  • 代码示例
InputStream inputStream = new ByteArrayInputStream(fileByte)
MultipartFile file = new MockMultipartFile(ContentType.APPLICATION_OCTET_STREAM.toString(), inputStream);
posted @ 2023-01-13 16:10  coolw  阅读(122)  评论(0编辑  收藏  举报