簡體   English   中英

文件對話框中可接受的擴展名

[英]Acceptable extensions in file dialog

如何使用JSPSpring MVC在文件對話框中設置可接受的擴展名? 這是我的方法:

<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>

我可以用Spring做這樣的事情嗎:

<input type="file" name="file" ext="xml, txt"/>

嘗試這個..

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

您不需要彈簧即可做到這一點。 這只是簡單的HTML。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM