Click here to Skip to main content
15,912,897 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello,

I am using FileUpload control to upload files. My requirement is when I click the Browse button, I should be able to see files of .pdf only. How can I mask for the File Type to be shown.

Thanks in advance.
Posted

1 solution

No. There is no way to set a direct filter to FileUpload control but you can add a file filtering logic that accepts only given file formats. This logic can be implemented on client or server side.
Check out this[^] article for implementation details.

:)
 
Share this answer
 
Comments
bedathur_ganesh 23-Aug-10 6:04am    
Thanks for the reply.. At present, we are implementing it using Javascript. But, I need to implement it by applying FileType masking.
Nuri Ismail 23-Aug-10 6:24am    
AFAIK, there is know way to display only given file types (like OpenFileDialog on Winforms does), because you cannot set a filter. The FileUpload control will always show all file types and you have to validate yourself on the client or/and on the server side.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900