Spring Boot 中 MultipartFile 的最大限制 [英] Max limit of MultipartFile in Spring Boot

查看:57
本文介绍了Spring Boot 中 MultipartFile 的最大限制的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

spring boot 在 MultipartFile 上传过程中是否有最大文件大小可以处理.我知道我可以在 multipart.maxFileSize=1Mb 之类的属性中设置 maxFileSize.

Is there a maximum file size that spring boot can handle in a MultipartFile upload process. I know that I can set the maxFileSize in the property like multipart.maxFileSize=1Mb.

这样,我可以允许上传一个巨大的文件,比如 50MB.该应用程序运行在与 Spring Boot 集成的 Tomcat 服务器上.我还需要配置tomcat服务器吗?还是文件大小无限?

So, like that can I allow a huge file to upload, like 50MB. The application runs on the Tomcat server integrated with Spring Boot. Do I need to configure the tomcat server also? Or is the file size unlimited?

推荐答案

对于那些使用 Spring Boot 2.0(从 M1 版本开始),属性名称已更改为:

For those using Spring Boot 2.0 (as of M1 release), the property names have changed to:

spring.servlet.multipart.max-file-size=10MB
spring.servlet.multipart.max-request-size=10MB

注意前缀是 spring.servlet 而不是 spring.http.

Note the prefix is spring.servlet instead of spring.http.

这篇关于Spring Boot 中 MultipartFile 的最大限制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆