Upload Component: how save an uploaded file?

Hi,
I use the
upload component
to upload a file and i want to
store the uploaded file
in the server,
how can I do this?
thanks for reply

By implementing Upload.Reciever:

public OutputStream receiveUpload(String filename, String MIMEType)

you get the file to that outputstream you return from the method. you’ll get it into by using a FileOutputStream. Other implementation out of OutputStream can be used if you want to store it elsewhere, ie. database. When you get a Upload.SucceededEvent you know that the data is in the file you specified.

Check
Book of Vaadin
for a reference implementation.

I use the FileOutputStream to save the uploaded file and it works :slight_smile:
thanks Jens.

Hello, I am developing a system to upload files of any type, pdf’s, executables, zip files and not understand how to save these files I a folder on my computer even, therefore want to understand it better, only to then bring up a server. could someone help me, by example vaadin upload couldnt understand where and how to save.

The uploaded files are stored on the server, not on your computer (unless you install the servlet engine on localhost)

You can look at the documentation here:

http://commons.apache.org/fileupload/

It is basically what the vaadin component does (plus of course all the GUI stuff)

André

Ok my friend, now worked out what he would do, since I already am grateful for your help.
a hug