On Dec 28, 11:13 pm, darkling <[email protected]> wrote: > I've read several posts about this but everyon seems to be using > different code and different methods. I've tried several but none seem > to work. I must be missing some fundamental component. > > I try to upload a file but even though the request arrives on server > side theres no file. The request is only 48 bytes and I can't figure > out why. If anyone can tell me what I'm doing wrong I'd greatly > appreciate it. > > Client side: > FormPanel form = new FormPanel(); > form.setEncoding(FormPanel.ENCODING_MULTIPART); > form.setMethod(FormPanel.METHOD_POST); > form.setAction("/adt/fileUpload"); > > form.addSubmitCompleteHandler(new FormPanel.SubmitCompleteHandler > () { > public void onSubmitComplete(SubmitCompleteEvent event) { > // When the form submission is successfully completed, this > event is > // fired. Assuming the service returned a response of type > text/html, > // we can get the result text here (see the FormPanel > documentation for > // further explanation). > errors.setHTML(event.getResults()); > }}); > > file = new FileUpload(); > file.setStylePrimaryName("FileUpload"); > form.add(file); > this.add(form);
You're not giving the FileUpload any name, so it won't be part of the form's data set thatn is sent to the server. Add a call to file.setName (...) somewhere. -- You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
