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"/>
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.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.