I'm preparing a project using Google Web Toolkit(GWT). I have to ask the user to upload a file(some text file) and have perform some operations on that file later. I have used FIleUpload to let the user upload a file, But what should I use to use that same file?
private FileUpload upload = new FileUpload();
private FormPanel fp = new FormPanel();
Following is the code in onModuleLoad()
String filename = upload.getFilename();
if (filename.length() == 0)
Window.alert("No file selected");
else {
fp.submit();
Window.alert("Please wait!!");
}
fp.addSubmitCompleteHandler(new FormPanel.SubmitCompleteHandler() {
@Override
public void onSubmitComplete(SubmitCompleteEvent event) {
// TODO Auto-generated method stub
Window.alert(event.getResults());
}
});
I have searched regarding this. Some say that downloading from client side isn't possible or I may have to use HTML5 for the same. So what is preferred to be done when I want that file, uploaded by the user, as a text/string or a file for further use?