triggering HTML5 upload from a button

261 views
Skip to first unread message

Matthew Pocock

unread,
Apr 12, 2012, 10:05:44 AM4/12/12
to lib-gwt-file
Hi,

Thanks for writing lib-gwt-file - it has saved me a lot of time. In my app, I've got a toolbar strip, including a button for file loading - a little picture of a floppy disk as usual. When this is clicked, I'd like to trigger the HTML5 file upload process. However, I don't seem to be able to achieve this without having a FileUploadExt widget visible. So, I'd either like to be able to trigger the file loading process direct from my button with the FileUploadExt widget not visible to the user, or skin the fileUploadExt widget so that it uses my picture for the button and doesn't show any other UI, including the file name.

Any idea how I can do this?

Thanks again for your library,

Matthew

--
Dr Matthew Pocock
Integrative Bioinformatics Group, School of Computing Science, Newcastle University
skype: matthew.pocock
tel: (0191) 2566550

Lukas Laag

unread,
Apr 13, 2012, 2:58:47 AM4/13/12
to lib-gw...@googlegroups.com
Hi Matthew,

Have you checked my sample application for lib-gwt-file (it is called
lib-gwt-file-test) ? There is a part which does that. I have a
CSS-hidden FileUploadExt, and a regular GWT button. When the button is
clicked, it invokes the FileUploadExt.click() method, which causes the
browser to display the platform file selection dialog.

You can find it here:
http://www.vectomatic.org/mvn-sites/lib-gwt-file-test-latest/xref/org/vectomatic/file/client/TestAppMain.html#281
(code)
http://www.vectomatic.org/gwt/lib-gwt-file-test-latest/lib-gwt-file-test.html
(online app)
https://github.com/laaglu/lib-gwt-file-test (github repo)

I have another piece of code online which also does that. In my online
SVG editor, I trigger a file selection dialog from an Ext-GWT menu:
https://github.com/laaglu/svgreal
http://www.vectomatic.org/gwt/svgreal-latest/svgreal.html?demo=013
http://www.vectomatic.org/mvn-sites/svgreal-latest/xref/org/vectomatic/svg/edit/client/SvgrealApp.html#673

Regards,
Lukas

Reply all
Reply to author
Forward
0 new messages