|
@@ -261,6 +261,23 @@ public class OssServiceImpl implements OssService {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public String uploadWithPath(OssRequest base, String path) throws Exception {
|
|
|
+ try {
|
|
|
+ //获取上传文件输入流
|
|
|
+ InputStream inputStream = base.getFile().getInputStream();
|
|
|
+ String originalFilename = base.getFile().getOriginalFilename();
|
|
|
+
|
|
|
+ PutObjectResult putObjectResult = ossClient.putObject(ALIYUN_OSS_BUCKET_NAME, path, inputStream);
|
|
|
+ // 关闭OSSClient。
|
|
|
+ //ossClient.shutdown();
|
|
|
+ return path;
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ throw new IllegalStateException("上传失败");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
@Override
|
|
|
public String uploadInputStream(InputStream inputStream, Integer imageStatus) throws Exception {
|
|
|
try {
|