Q:

Acceptable extensions in file dialog

How can I set acceptable extensions in file dialog using JSP and Spring MVC? This is how I do:
<form:form method="post" enctype="multipart/form-data"
        modelAttribute="uploadedFile" action="fileUpload">
        <table>
            <tr>
                <td>Upload File:</td>
                <td><input type="file" name="file" /></td>
                <td style="color: red; font-style: italic;"><form:errors
                        path="file" /></td>
            </tr>
            <tr>
                <td></td>
                <td><input type="submit" value="Upload" /></td>
                <td></td>
            </tr>
        </table>
    </form:form>

Can I do something like this with Spring:
<input type="file" name="file" ext="xml, txt"/>

A:

Try this..
<html>
<body>
<input type="file" name="fi" accept="text/xml, text/plain"/>
</body>
</html>

You don't need spring to do this. It is just simple HTML.

