Shailesh Kumar
Shailesh Kumar

Reputation: 6967

controlling file types in HTML file input/upload dialog

Is there a way to specify the file types which can be accepted by HTML File Input/Upload dialog?

<input type="file" value="Upload XML file"/>

I wish to control that only certain file types are visible in the dialog based on their extensions.

Upvotes: 2

Views: 2459

Answers (1)

Ben Everard
Ben Everard

Reputation: 13804

Take a look at this answer -> File input 'accept' attribute - is it useful?

The accept attribute of input element was meant to provide mime-type filtering, however whilst the accept attribute exists within the RFC 1867, it would appear that the majority of browsers do not use this.

You will have to look for a JavaScript / Flash alternative, as suggested in the referenced post.

Upvotes: 1

Related Questions