当前位置:网站首页>YYGH-BUG-03
YYGH-BUG-03
2022-06-28 05:41:00 【小赵呢】
今天在做图片上传系统,整合七牛云的时候在上传一个文件的时候报错
org.springframework.web.multipart.MaxUploadSizeExceededException: Maximum upload size exceeded; nested exception is java.lang.IllegalStateException: org.apache.tomcat.util.http.fileupload.FileUploadBase$FileSizeLimitExceededException: The field file exceeds its maximum permitted size of 1048576 bytes.
通过分析问题我们知道这是因为,上传的图片太大了
这时扫描需要修改一下配置文件就好了
spring.servlet.multipart.max-file-size=10MB
spring.servlet.multipart.max-request-size=10MB
现在我们需要在对上产业务进行一下升级就是为图片加上一个随机生成的uuid
String uuid = UUID.randomUUID().toString().replace("-", "");
String fileName = uuid + file.getOriginalFilename();
然后再把文件分别存储到日期对应的文件夹
String uuid = UUID.randomUUID().toString().replace("-", "");
String fileName = uuid + file.getOriginalFilename();
String timeUrl = new DateTime().toString("yyyy/MM/dd");
fileName = "/" + timeUrl + "/" + fileName;
Response response = uploadManager.put(file.getInputStream(), fileName, upToken, null, null);
在这里插入图片描述
在用户上传系统中图片无法被识别打开,调试
发现他自己拼接了一个路由查看数据库发现url有问题http://少了//
查阅资料发现
更改

可以了
现在把service_oss的代码也改掉
边栏推荐
- Data middle office: an article that takes you to understand data middle office in simple terms
- 双向电平转换电路
- 小球弹弹乐
- 2022年全国职业院校技能大赛“网络安全”竞赛试题官方答案
- Interpretation of cloud native microservice technology trend
- Data warehouse: DWS layer design principle
- 马赛克数据增强 mosaic
- The windows environment redis uses AOF persistence and cannot generate an AOF file. After generation, the content of the AOF file cannot be loaded
- Filecoin黑客松开发者大赛
- Where is the era bonus for developers?
猜你喜欢

Line animation

? How to write the position to output true

Filecoin黑客松开发者大赛

FB、WhatsApp群发消息在2022年到底有多热门?

Bidirectional level conversion circuit

The windows environment redis uses AOF persistence and cannot generate an AOF file. After generation, the content of the AOF file cannot be loaded

6. graduation design temperature and humidity monitoring system (esp8266 + DHT11 +oled real-time upload temperature and humidity data to the public network server and display the real-time temperature

Binder面试之:内存管理单元

Capacity scheduling absolute value configuration queue usage and pit avoidance

Mysql-16-subquery
随机推荐
Data middle office: an article that takes you to understand data middle office in simple terms
Jenkins持续集成1
Binder面试之:内存管理单元
pkg打包node工程(express)
FB、WhatsApp群发消息在2022年到底有多热门?
Error: the following arguments are required:
北斗三号短报文终端在大坝安全监测方案的应用
什么是WebRTC?
预训练模型参数不匹配
Windows环境Redis使用AOF持久化,无法生成AOF文件,生成后无法加载AOF文件内容
sklearn 特征工程(总结)
Oracle基础知识总结
函数栈帧的创建和销毁
关系数据库与文档数据库对比
Data midrange: implementation and summary of AI midrange
数据仓库:DWS层设计原则
猿粉猿动力-开发者活动袭!
【JVM】——JVM中內存劃分
JS中的链表(含leetcode例题)<持续更新~>
Enum