feat(content): Implement content module foundation
This commit is contained in:
@@ -224,4 +224,24 @@ public class MinioUtils {
|
||||
throw new RuntimeException("获取文件基础URL失败", e);
|
||||
}
|
||||
}
|
||||
|
||||
public String uploadObject(String fileType, String fileName, InputStream inputStream, long size, String contentType) throws Exception {
|
||||
// 检查存储桶是否存在
|
||||
createBucket(bucketName);
|
||||
|
||||
// 生成对象名称
|
||||
String objectName = fileType + "/" + fileName;
|
||||
|
||||
// 上传文件
|
||||
minioClient.putObject(
|
||||
PutObjectArgs.builder()
|
||||
.bucket(bucketName)
|
||||
.object(objectName)
|
||||
.stream(inputStream, size, -1)
|
||||
.contentType(contentType)
|
||||
.build()
|
||||
);
|
||||
|
||||
return objectName;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user