如何在spring mvc中使用多个属性上传多个文件

时间:2014-03-04 05:03:33

标签: spring-mvc

提供一些示例代码,以便在spring框架中上传多个文件。

当我为此搜索解决方案时,每个人都写了这样的jsp页面:

<input type='file' name='files[]' multiple />

但这不是我真正想要的场景

这里是我的jsp页面代码: multiFileSelect.jsp

<%@ page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>JSP Page</title>
    </head>
    <body>
        <form action="upload" enctype="multipart/form-data" method="post">
            <input name="files" type="file" multiple/>
            <button type="submit"/>
        </form>
    </body>
</html>

请帮帮我......

2 个答案:

答案 0 :(得分:0)

This将是一个有用的链接,如果您想要更简单的版本,请参阅this link

答案 1 :(得分:0)

我认为Chann已经解决了你的问题。

<input type="file" name="img" multiple>

更一般的一个

<input type="file" multiple/>

由于您已经问过该示例用法,请参阅this所以问题(我不知道您错过了这个问题的原因)以及SO用户code example的示例Costa }。

相关问题