相关疑难解决方法(0)

如何在Grails中迭代上传的文件

我有这个GSP:

<g:uploadForm name="myForm" action='save'>    
    <input type='file' name='documentFile' value=''/>
    <input type='file' name='documentFile' value=''/>
    <input type='file' name='documentFile' value=''/>
    <input type='file' name='documentFile' value=''/>
    <input type='submit' value='Submit'/>
</g:uploadForm>
Run Code Online (Sandbox Code Playgroud)

但是当我尝试通过键入以下内容来查看控制器中的结果时:

render(params);
return true;
Run Code Online (Sandbox Code Playgroud)

我得到了这个结果:

"documentFile":org.springframework.web.multipart.commons.CommonsMultipartFile@14dcf95
Run Code Online (Sandbox Code Playgroud)

如何阅读正在上传的每个文件?我可以得到以下内容吗?

documentFile:[File,null,File,null] // (if the 2nd and the 4th are not being used)
Run Code Online (Sandbox Code Playgroud)

ps:我正在使用grails 1.2.2

java grails groovy file-upload

7
推荐指数
2
解决办法
4596
查看次数

标签 统计

file-upload ×1

grails ×1

groovy ×1

java ×1