views:

278

answers:

2

Hello,

Im writing some java code and im hitting a wall, with FileUpload, i am trying to get a alternate button to activate the filebrowser from the FileUpload.

I tried to dispatch the event from one to another, tried to extend FileUpload to have a button that triggers some action but no luck.

Fileupload upload = new FileUpload(); Button b = new Button("Browse",new ClickHandler() { // trigger upload Browser });

Something like this.

A: 

You cannot do this due to security restrictions. The restriction is that untrusted code cannot trigger the File Browse dialog to open because it could then do so without user input, possibly tricking the user into thinking the dialog is from a different webapp or entirely different application.

Mark Renouf
Thanks, i thought that if the FileUpload was attached to the Document it was only a matter of event exchange.I was trying to avoid a non-java solution, for a crossbrowser FileUpload layout, because they are different in each browser.
bimbojones
A: 

Actually it is possible on IE6 and maybe IE7, all other prohibit this action. Read my question and answer: http://stackoverflow.com/questions/632669/gwt-fileupload

You might give a shot to SWFUpload in combination with swfupload-gwt.

Drejc