How to change extension filters within Upload component ?

Hi,

I would like to configure the extension filters within the web browser’s native file browser.
For now I am using the StartedListener to check the extension of the file, but it is still a workaround for me.

Any idea would be gratefully appreciated !

Hi,

As far as I know it is not possible with html file input. Using swfupload (flash file upload helper) based upload widget might be an option if it is really needed. Still, I’d be surprised if it works well cross platform.

cheers,
matti

You could implement RFC 1867

http://en.wikipedia.org/wiki/File_select#Accept_attribute

Supported by Opera 11+, Chrome 16+ and Firefox 9+

Thanks

It should be possible to add support to specify the accept attribute for an Upload component.

Created
enhancement request #8857
not to forget this.

The simplest solution I found was to modify the input tag inside Upload component by this jQuery expression:

JavaScript.getCurrent().execute(“$(‘.gwt-FileUpload’).attr(‘accept’, ‘application/pdf’);”);

This should be executed after the Upload component as been added to its parent layout.[font=Courier New]

[/font]