兼容S3 协议的通用文件存储工具类 ,支持 兼容S3 协议的云存储
- MINIO
- 阿里云
- 华为云
- 腾讯云
- 京东云
...
- 方便在 web 环境下使用
oss
,已上传至 maven 仓库
<dependency>
<groupId>com.pig4cloud.plugin</groupId>
<artifactId>oss-spring-boot-starter</artifactId>
<version>0.0.6</version>
</dependency>
oss:
#使用云OSS 需要关闭
path-style-access: false
#对应上图 ③ 处配置
endpoint: s3-cn-east-1.qiniucs.com
# 上文创建的AK, 一定注意复制完整不要有空格
access-key: xxx
# 上文创建的SK, 一定注意复制完整不要有空格
secret-key: xxx
# 上文创建的桶名称
bucketName: pig4cloud
@Autowired
private OssTemplate template;
/**
* 上传文件
* 文件名采用uuid,避免原始文件名中带"-"符号导致下载的时候解析出现异常
*
* @param file 资源
* @return R(bucketName, filename)
*/
@PostMapping("/upload")
public R upload(@RequestParam("file") MultipartFile file, HttpServletRequest request) {
template.putObject(CommonConstants.BUCKET_NAME, fileName, file.getInputStream());
return R.ok(resultMap);
}
oss-spring-boot-starter's People
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.