This project has moved. For the latest updates, please go here.

How to only accept specific file extensions?

Mar 25, 2009 at 12:17 AM
Edited Mar 25, 2009 at 12:22 AM
Is there any way to configure it so that it only accepts specific file extensions?  The filter setting only tells the file open dialog what filters to list. it doesn't prevent someone from entering files with extensions outside that list.

Example in my case I only want to accept *.zip, *.pdf, *.doc files.

In the default implementation it looks like it would let someone upload *.exe, *.aspx, *.asp... etc files

Very cool control btw
Coordinator
Mar 25, 2009 at 8:03 AM
I never noticed that, but you're right. The FileFilter setting only filters the displaying of files in the Open File Dialog, not the actual selection. You're still able to type in any file extension.

The MSDN documentation also only talks about a "display" filter:
http://msdn.microsoft.com/en-us/library/system.windows.controls.openfiledialog.filter(VS.95).aspx

I will try to add an extra file extension check in the next version.
Jul 25, 2009 at 1:52 AM

Were you able to add the extra file extension checks in the new version (just released)?

Coordinator
Jul 26, 2009 at 8:48 AM

No, the extra file extension check is not included yet in the latest version.