.hi.
I am trying to download a file from vaadin server. i found FileDownloaderFileDownloader(StreamResource resource , String fileName)
that i can use for my purpose. But I'm looking for a way to get the directory and filename from client graphically and set it to my StreamResource. Something like a file chooser...
what component can I use?
I'm new to everything! so if my question is obscure, let me know(give me comment).
Asked
Active
Viewed 441 times
0

HoseinPanahi
- 582
- 2
- 8
- 18
-
1This is Not passable. You can ask the User via a TextField for the Name, but the Directory where the file is saved is outside of servercontrol. This is Not a vaadin restriction, It 's that way for all weebsolutions – André Schild Aug 22 '17 at 19:28
-
If it's the server you want to _browse_ for certain files, you could start from a _root_ directory, [walk through all its children](https://docs.oracle.com/javase/tutorial/essential/io/walk.html) and populate a Tree or TreeGrid to visually display something similar to windows explorer (you can also use icons to differentiate between folders and files). Then you could add a context menu to allow the user to download the selected file. – Morfic Aug 23 '17 at 18:03
-
Or do you want to upload a file from client (where the browser runs on) to the server (where your Vaadin app runs on)? In that case you should check out the [upload component](https://vaadin.com/docs/-/part/framework/components/components-upload.html). – Steffen Harbich Aug 24 '17 at 08:13
-
no, i don't want to upload from client to server. i want to download a file from server and put that file in a specified directory in client system(Desktop for example) @SteffenHarbich – HoseinPanahi Aug 24 '17 at 08:45
-
Then you should see @Morfic suggestion, that's a good way to do it. – Shirkam Aug 25 '17 at 06:58
1 Answers
0
As André pointed out in the comments, you cannot control where a downloaded file is stored by the browser on client system. Usually the browser will ask the user for a file location to save the file being downloaded.

Steffen Harbich
- 2,639
- 2
- 37
- 71