您现在的位置是: 首页 > 后端开发 SpringBoot 2.x 文件上传出现 The field file exceeds its maximum permitted size of 1048576 bytes
SpringBoot 2.x 文件上传出现 The field file exceeds its maximum permitted size of 1048576 bytes
2020-09-14 【后端开发】 7330人已围观 13414次浏览
简介SpringBoot 2.x 文件上传出现 The field file exceeds its maximum permitted size of 1048576 bytes
在 SpringBoot 项目中进行文件上传时,由于之前都是使用的小文件来测试,并没有出现问题,也就没有考虑到文件上传大小限制的问题,今天在处理视频上传时,提示下面的错误
org.apache.tomcat.util.http.fileupload.impl.FileSizeLimitExceededException: The field file exceeds its maximum permitted size of 1048576 bytes.
根据提示,发现是文件太大,超出了默认的最大上传限制(默认是 1MB 的文件大小限制)
查看文档发现,SpringBoot 2.x 中,只需要修改配置文件,就可以解决该错误。下面是 yml 格式的配置文件
spring:
servlet:
multipart:
max-file-size: 50MB
enabled: true
修改其中的 spring.servlet.multipart.max-file-size 为项目中所需的最大上传文件大小限制即可。重启项目,再上传 50MB 以内的文件就不会出现报错了
很赞哦! (0)
相关文章
- 删除Git仓库所有历史提交记录,成为一个干净的仓库
- 获取阿里云CDN真实IP
- springboot引入mybatis-plus后出现ClassNotFoundException: org.mybatis.logging.LoggerFactory
- PHP 在执行 composer install 时出现提示 PHP Fatal error: Allowed memory size of XXXXXX bytes exhausted <...>
- SpringBoot 启动测试时出现提示 Test class should have exactly one public zero-argument constructor
- Error in execution; nested exception is io.lettuce.core.RedisCommandExecutionException: ERR DISABLE You can't write or read against a disable instance
- SpringBoot 2.x Security security.basic.enabled=false 失效问题解决
- SqlServer 刷新所有视图
- SpringBoot @NotBlank 不生效问题
- start.spring.io访问太慢,构建SpringBoot项目失败
点击排行
- Error in execution; nested exception is io.lettuce.core.RedisCommandExecutionException: ERR DISABLE You can't write or read against a disable instance
- Debian apt 使用国内镜像
- RocketMQ 出现 sendDefaultImpl call timeout 问题
- 类 BASE64Decoder 程序包 sun.misc 找不到符号
- SpringBoot @NotBlank 不生效问题
- 记一次 Mybatis-Plus 自动填充无效问题解决
- SpringBoot 2.x 文件上传出现 The field file exceeds its maximum permitted size of 1048576 bytes
- nuxt 项目完整部署方案
站长推荐
猜你喜欢
- Oracle ORA-12541:TNS:no listener错误解决方法
- SpringBoot 2.x Security security.basic.enabled=false 失效问题解决
- 【Docker】unauthorized: incorrect username or password
- Debian apt 使用国内镜像
- SpringBoot 启动提示 Requested bean is currently in creation: Is there an unresolvable circular reference?
- SqlServer 查询包含指定字段的存储过程
- win10 cmd下运行python命令弹出windows应用商店问题
- Linux 常用命令 持续更新中...
- gulp3 在 node12 上运行出现异常 primordials is not defined
- Mac 设置允许任何来源