hi guys,
I’m new to spring and I’m trying to build a small application to allow file upload.
Basically you should be able to upload a file from the computer file system and display the content of the file inside a textarea, and I was wondering if anybody can give me a few suggestions and guide me through the process please
i’ve found some suggestions here and there, even on the vaadin book but i’m still a bit unsure.
So, I’ve started a Maven project and this is what I have so far:
public class MyUI extends UI implements Receiver, SucceededListener{
@Override
protected void init(VaadinRequest vaadinRequest) {
final VerticalLayout layout = new VerticalLayout();
TextArea fileArea = new TextArea("File information");
fileArea.setRows(20);
fileArea.setWidth("350px");
final TextField name = new TextField();
name.setCaption("Load the file here:");
layout.addComponents( label, name, button, fileArea);
layout.setMargin(true);
layout.setSpacing(true);
setContent(layout);
}
MyUI receiver = new MyUI();
Upload upload = new Upload("Upload File Here", receiver);
}
So, my main class implements Receiver and SucceedeListener interfaces to implement the upload functionality.
I created an upload object called upload and now I presume it’s just a matter of writing the uploadSucceeded(Upload.SucceededEvent event) that is required, but how would I handle the file stream?
thanks