import org.springframework.mock.web.MockMultipartFile;
import org.springframework.web.multipart.MultipartFile;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
public class FileUtils {
public static MultipartFile fileToMultipartFile(File file) throws IOException {
InputStream inputStream = new FileInputStream(file);
return new MockMultipartFile(file.getName(), inputStream);
}
}
file转multipartFile
最新推荐文章于 2024-05-02 13:08:19 发布