Is there any way to open the file explorer setting the filtering options like a desktop application does?, and I don't want to validate the file after is selected, I want my users to view only valid files throught filtering them before.
views:
33answers:
3NO, this is not possible using the asp:FileUpload Control.
How to filter files in file upload control
seems like there is a way using JavaScript.
There is an "accept" attribute which can be set for the upload control however as discussed here, many browsers don't impliment this attribute.
Your best bet is to use Javascript as astander recommends so that you can check the extension of the file being uploaded before it hits the server.
You'll also want to do a check on the server side since client-side validation cannot be relied on for this type of thing.
No, for web applications there is no way yet (Dec 2009) to set the File Selector filtering. According to the INPUT tag (used by the UploadFile control to render) documentation it should be possible by adding the 'accept' attribute and setting the file mime type(s)... so bad that any major browser supports the accept attribute of input tags.
The best workaround is to validate the files on the client and server side.