3

Possible Duplicate:
How to get the HTML's input element of “file” type to only accept pdf files?

I have basic HTML input tag and content-type="audio/wav"

<input type="file" name="file" />

by using this we will get chose file or browse file. When you click on chose file button this open system window which shows the all file.

But my requirement is I want to show only ".wav" in this popup.

Community
  • 1
  • 1
Yasin
  • 181
  • 1
  • 5
  • 17

2 Answers2

0

I'm afraid you can't, at least with standard html controls.

Here you will find a list of attributes you can specify for input tag and there is nothing suitable. http://www.w3schools.com/TAGS/tag_input.asp

Eineki
  • 14,773
  • 6
  • 50
  • 59
  • 1
    W3Schools is rubbish ( http://w3fools.com/ ) but even they haven't failed to notice (right at the top of the list) the `accept` attribute (although it comes with caveats ) – Quentin Mar 01 '11 at 09:44
  • Is not working in firefox. – Yasin Mar 01 '11 at 11:30
  • 1
    @David Dorward: I thank you for the info on w3school, I didn't know about it. By the way: Are the info I'm providing wrong? Are the info provided into the page I linked wrong (provided that the accept attribute won't work in mayors brother and therefore it is useless)? In other words: why the downvote? – Eineki Mar 01 '11 at 11:37
  • accept="audio/*" working fine in chrome showing audio type file in popup, same thing is not working in firefoz this is showing all kind of files. I don't know why. any other way to do this? – Yasin Mar 01 '11 at 11:57
0

If you use an "open file dialog, this will explain it to you: http://www.eggheadcafe.com/community/aspnet/2/10051298/how-to-use-openfile-dialog-in-c-with-aspnet.aspx