设置最大文件大小的值,在Servlet类或web.xml
配置之前使用注释。请参阅maxFileSize
注释或<max-file- size></max-file-size>
xml配置。
@MultipartConfig(
location="/tmp",
fileSizeThreshold=1024*1024, // 1 MB
maxFileSize=1024*1024*5, // 5 MB
maxRequestSize=1024*1024*5*5 // 25 MB
)
要么
<multipart-config>
<location>/tmp</location>
<max-file-size>20848820</max-file-size>
<max-request-size>418018841</max-request-size>
<file-size-threshold>1048576</file-size-threshold>
</multipart-config>
参考:https ://docs.oracle.com/javaee/7/tutorial/servlets011.htm