« New way to obfuscate … | Home | Tip of the day: Invis… »

Tip of the day: WebFileUploader File Types

If you like to limit what file types can be accessed in a file uploader, you can set it like this:

dim js as string = "document.getElementById('" + FileUploader1.ControlID+ _
"').getElementsByTagName('input')[0].accept = 'image/jpeg';"
ExecuteJavaScript js

Put this code in a shown event if you like. It will lookup the file uploader control in javascript, look inside of the input element and set the accept parameter there to image/jpeg. Now you can only select jpeg images. Works of course only for the mime types known on the given PC running the app.

See also Feedback case 32040 for this topic and find there an example project. The biggest plugin in space...
03 02 14 - 12:34