1 Star 0 Fork 0

Yore Yuen/mySpringBoot

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README

Spring Boot 实现多文件(图片)上传接口

说明

环境或依赖 版本
JDK 8
Spring Boot 2.0.2.RELEASE
qiniu-java-sdk 7.2.23

接口

{
	"@type": "yore.VO.ResultVO",
	"code": 200,
	"data": [
		{
			"@type": "yore.VO.FileVO",
			"code": 401,
			"height": null,
			"msg": "文件非图片:file",
			"url": "",
			"width": null
		},
		{
			"@type": "yore.VO.FileVO",
			"code": 200,
			"height": 534,
			"msg": "文件上传成功",
			"url": "http://q24zo797k.bkt.clouddn.com/yore/image/2019/12/07/dc6a8f02-3669-4b2f-af1e-4159c912afea.png",
			"width": 660
		},
		{
			"@type": "yore.VO.FileVO",
			"code": 200,
			"height": 610,
			"msg": "文件上传成功",
			"url": "http://q24zo797k.bkt.clouddn.com/yore/image/2019/12/07/22e8566a-0e4b-451f-a206-99c1bcf8800a.png",
			"width": 602
		}
	],
	"msg": "文件上传成功",
	"t": 1575729175000
}
mysql> use test;
-- id 为主键,uid 用户标识,width 图片宽,height 图片高度,单位像素。
mysql> select * from file_image;
+----+--------+-----+-------------------------------------------------------------------------------------------------+-------+
| id | height | uid | url                                                                                             | width |
+----+--------+-----+-------------------------------------------------------------------------------------------------+-------+
|  7 |    610 | 325 | http://q24zo797k.bkt.clouddn.com/yore/image/2019/12/07/22e8566a-0e4b-451f-a206-99c1bcf8800a.png |   602 |
|  6 |    534 | 325 | http://q24zo797k.bkt.clouddn.com/yore/image/2019/12/07/dc6a8f02-3669-4b2f-af1e-4159c912afea.png |   660 |
+----+--------+-----+-------------------------------------------------------------------------------------------------+-------+
2 rows in set (0.00 sec)
欢迎访问我的 blog 使用七牛云对象存储服务,实现Spring Boot多文件(图片)上传接口
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/yoreyuan/mySpringBoot.git
git@gitee.com:yoreyuan/mySpringBoot.git
yoreyuan
mySpringBoot
mySpringBoot
master

搜索帮助