您的位置:首页 > 大数据 > 人工智能

解决grails上传图片大小过大报错问题

2017-09-21 09:32 369 查看
Class
org.apache.tomcat.util.http.fileupload.FileUploadBase$SizeLimitExceededException
Message

Request processing failed; nested exception is org.springframework.web.multipart.MultipartException: Could not parse multipart servlet request; nested exception is java.lang.IllegalStateException: org.apache.tomcat.util.http.fileupload.FileUploadBase$SizeLimitExceededException:
the request was rejected because its size (288940) exceeds the configured maximum (128000)

解决方法:
1、打开文件:xxx\grails-app\conf\spring\resources.groovy

2、导入CommonsMultipartResolver需要的jar包



3、写上以下代码即可
// Place your Spring DSL code here
import org.springframework.web.multipart.commons.CommonsMultipartResolver
beans = {

//  默认上传文件大小
    multipartResolver(CommonsMultipartResolver){
        maxUploadSize = 41943040
// 40MB
        maxInMemorySize = 41943040
        defaultEncoding = "utf-8"
    }

}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐