MultipartHttpServletRequest

MultipartHttpServletRequest

我需要上传文件:

def newTeam(String nameTeam){
render '123 ' + nameTeam
if(request instanceof MultipartHttpServletRequest) {
MultipartHttpServletRequest mpr = (MultipartHttpServletRequest)request
CommonsMultipartFile f = (CommonsMultipartFile) mpr.getFile("myFile");
}
}

我有错误:



It is fix.但是我不知道如何使用它。我必须在resources.groovy中编写dsl代码。

最佳答案

尝试在build.gradle中添加以下内容:

dependencies {
    ....
    compile 'commons-fileupload:commons-fileupload:1.3.2'
}

09-27 06:00