Same problem here: I have a class that extends FormPanel (intented to upload files to a servlet) and I have the following client code:
Code:
//...
this.setMethod(Method.POST);
this.setEncoding(Encoding.MULTIPART);
this.setAction(fileUploadAction);
this.addListener(Events.Submit, new Listener<FormEvent>() {
public void handleEvent(FormEvent arg0) {
MessageBox.alert("Result", "Check Forums on how to get an actual result: "
+ arg0.getResultHtml(), null);
atualizarPesquisa();
}
});
//...
here goes the server side code:
Code:
FileItem uploadItem = getFileItem(request); //ommited, it works anyway
byte[] fileContents = uploadItem.get();
// persist file on db... (ommited)
response.setStatus(HttpServletResponse.SC_CREATED);
response.setContentType("text/plain");
response.getWriter().print("id do arquivo = " + Arquivo.numeroArquivos);
response.flushBuffer();
I've tried both hosted andserver mode but unfortunately when I attempt to this.submit() nothing happens. As a test I tried the Events.BeforeSubmit and it worked fine. Not sure what I'm missing...
any help will be apreciated.
thanks in advance!