tags:

views:

166

answers:

1

Hello,

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.

+1  A: 

Take a look at this answer -> http://stackoverflow.com/questions/181214/file-input-accept-attribute-is-it-useful/181291#181291

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.

ILMV