Choosing a location to write a file to

I need to be able to look through the folders on a computer to choose a location to write a new file. Is there anything like a file chooser in Vaadin or a way that I can look through the folders?

Thanks

Hi,

Not built-in, no - projects quite seldom need (or want) the user to select a folder on the server. However, you should be able to build one quite easily, for instance using
FileSystemContainer
as a container for
Tree
. Beware of all the security issues when allowing a user to browse the servers filesystem, though!

Best Regards,
Marc

What about choosing a location on the client? I want to implement two buttons in my UI, an Upload and a Download. The Upload button will obviously use the Upload component. However, I also want to be able to prompt for a location on the client machine where a file should be downloaded. Is there any kind of file prompter widget that can allow the user to pick a target directory on the client for a download? If not, is there a way to start a process of downloading that would force the client system to ask where a file should be written?

Thanks in advance,
David

I don’t think it would be very easy to allow a directory to be selected in the browser. The best you will be able to do is send a file to the browser and based on the browser the browser will allow the user to store it where it sees fit. However some browsers will just save a file to a predefined location without user intervention.

http://vaadin.com/forum/-/message_boards/view_message/85012

Hi All

I have similar requirement ,upload a file ,parse it at server ,and then export the excel sheet with that parsed data to client target whichever location chosen by him.
Please let me know if any one got the solution .
I have tried this ,but its not working

ublic class LogApplication extends Application {

@Override
public void init() {
	final Window mainWindow = new Window("Jaimatadi Application");
	Label label = new Label("Hello Vaadin user");

	mainWindow.addComponent(label);

	Panel myPanel = new Panel("my panel");
	Embedded embedded = new Embedded();
	FileDownloadResource fResource = new FileDownloadResource(new File(
			"C:/test"), LogApplication.this);
	embedded.setSource(fResource);
	fResource.getStream().setParameter("Content-Disposition",
			"attachment; filename=" + "test"); //
	embedded.setMimeType("application/octet-stream");
	embedded.setType(Embedded.TYPE_BROWSER);
	myPanel.addComponent(embedded); // //

	final Button downloadResultButton = new Button();
	downloadResultButton.setCaption("Button");
	downloadResultButton.addListener(new ClickListener() {

		public void buttonClick(ClickEvent event) {
			// mainWindow.open(new FileResource(new File("C:/test"),
			// JaimatadiApplication.this));
			FileDownloadResource f = new FileDownloadResource(new File(
					"C:/test"), LogApplication.this);
			mainWindow.open(f);

		}
	});
	mainWindow.addComponent(downloadResultButton);
	setMainWindow(mainWindow);

}

Thanks