2

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.

Shailesh Kumar
  • 5,447
  • 5
  • 29
  • 56

1 Answers1

1

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.

Community
  • 1
  • 1
Ben Everard
  • 13,254
  • 12
  • 63
  • 95