Biswas
Biswas

Reputation: 598

input tag with accepts

I have a file to upload in my page.

<input type="file" id='fFile' name="template"/>

But I want it to show only rptdesign file. Could anyone please help?

Also I have added

<input type="file" id='fXls' name="template"
accept="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"/>

for xlsx but when the dialog box appears with All files and Xlsx in the dropdown but all All Files selected. Can Xlsx be selected?

Upvotes: 1

Views: 87

Answers (2)

Josef E.
Josef E.

Reputation: 2219

Look into MIME_Types:

<input accept="audio/*|video/*|image/*|MIME_type">

A list of different media MIME-types here!

Note: The accept attribute of the input tag is not supported in Internet Explorer 9 and earlier versions.

EDIT

In your Tomcat configuration files, go to your web.xml.

If you scroll down you will find mime-type mapping. Here you can specify extensions for the server!

Example (web.xml):

<mime-mapping>
        <extension>asx</extension>
        <mime-type>video/x-ms-asf</mime-type>
</mime-mapping>

Hopefully that helps!

Upvotes: 1

Biswas
Biswas

Reputation: 598

In chrome its working fine and I found out that firefox are still working on it.

https://bugzilla.mozilla.org/show_bug.cgi?id=826185

Upvotes: 0

Related Questions