Advertisement

Spring Boot file upload size limit: Exceeds the maximum allowed size for the field (1048576 bytes).

阅读量:

SpringBoot文件上传大小限制问题

在这里插入图片描述
复制代码
    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.] with root cause
    
    
      
    

解决方法概述

出现错误的主要因素在于,SpringBoot项目内嵌的Tomcat服务器对上传文件的尺寸设定了默认限制。根据SpringBoot官方文档中的说明,单个文件的配置上限为1Mb,而单次请求中所有文件的总容量不得超过10Mb。

复制代码
    spring:
      servlet:
    multipart:
      m

全部评论 (0)

还没有任何评论哟~