Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

File chooser for vaadin web application

Tags:

java

swing

vaadin

I am working on a vaadin web application. I want to have a JFileChooser type thing in my application by using which I would be able to get a path of a choosen file. I had used JFileChooser initially, but it only prompt on server computer, not on client. So I want the same thing for my client side on browser. Thanks.

like image 698
Muhammad Salman Farooq Avatar asked Jan 01 '26 03:01

Muhammad Salman Farooq


1 Answers

You want to use a Upload component - see https://demo.vaadin.com/sampler/#ui/data-input/other/upload for an example. There are also separate components in the Vaadin directory (e.g. https://vaadin.com/directory#addon/easyuploads) might be more appropriate for your use-case.

It's important to note that you cannot control the appearance of the file browser at all - for example, you cannot point it to a particular directory, or limit the filter (e.g. specify *.doc). The "FileChooser" is completely in the control of the browser.

It might be possible to incorporate a third-party file upload widget into a Vaadin component, such as SWFUpload or JUpload, but I have not seen any examples nor had any experience with doing this.

like image 55
Charles Anthony Avatar answered Jan 02 '26 16:01

Charles Anthony



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!