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

来源:互联网 发布:新人一元购的软件 编辑:程序博客网 时间:2024/06/05 09:03
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"
    }


}

阅读全文
0 0
原创粉丝点击