当前位置:网站首页>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的代码也改掉
边栏推荐
- 学术搜索相关论文
- Codeworks 5 questions per day (1700 for each)
- Data warehouse: financial / banking theme layer division scheme
- 8VC Venture Cup 2017 - Elimination Round D. PolandBall and Polygon
- Error: the following arguments are required:
- jsp连接oracle实现登录注册(简单)
- 原动力×云原生正发声 降本增效大讲堂
- Blog login box
- Typescript interface
- Flink window mechanism (two waits and the last explanation)
猜你喜欢

Line animation

Jenkins continuous integration 1

Bidirectional level conversion circuit

sklearn 特征工程(总结)

Sharing | intelligent environmental protection - ecological civilization informatization solution (PDF attached)
![[JVM] - memory partition in JVM](/img/d8/29a5dc0ff61e35d73f48effb858770.png)
[JVM] - memory partition in JVM

博客登录框

Interpretation of cloud native microservice technology trend

Share a powerful tool for factor Mining: genetic programming
![[untitled] drv8825 stepping motor drive board schematic diagram](/img/30/02f695592f3b624ebbb2b7a9f68052.png)
[untitled] drv8825 stepping motor drive board schematic diagram
随机推荐
pytorch dataloader的长度 epoch与iteration的区别
CSI以及本地盘的相关实现记录
Jenkins continuous integration 1
6. 毕业设计温湿度监控系统(ESP8266 + DHT11 +OLED 实时上传温湿度数据给公网服务器并在OLED显示屏上显示实时温湿度)
Academic search related papers
Capacity scheduling absolute value configuration queue usage and pit avoidance
数据仓库:DWS层设计原则
[C language practice - printing hollow square and its deformation]
上海域格ASR CAT1 4g模块2路保活低功耗4G应用
V4l2 driver layer analysis
一看就会 MotionLayout使用的几种方式
FB、WhatsApp群发消息在2022年到底有多热门?
TypeScript接口
Relevant implementation records of CSI and local disk
Error: the following arguments are required:
Data middle office: construction ideas and implementation experience of data governance
Zzuli:1071 decomposing prime factor
Shutter nestedscrollview sliding folding head pull-down refresh effect
开发者的时代红利在哪里?
Data warehouse: detailed explanation of hierarchical design