Thanks people. The file upload doesn't work if I fiddle around with it myself (for security reasons). As other pointed out, it has to be rendered and the user has to click OK. I got it working now.
Bala. On Sun, Dec 7, 2008 at 9:29 PM, vaibhav <[EMAIL PROTECTED]> wrote: > Hi Bala, > > Most probably you also have to set the name of the fields too. The fields > that you want to send to the server should contain the name. The text box > that you are using just set the name of that and try to get the parameter > from same name on the server. > > > > Regards, > > Vaibhav > > > > From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf > Of avadh patel > Sent: Saturday, December 06, 2008 7:57 AM > To: [email protected] > Subject: Re: file upload > > > > Bala: > > I believe the reason is that forms that are not attached to the DOM tree or > are invisible to user are not submitted by the browsers. So that you have to > change your uploadForm to visible mode and attach it to the DOM tree. > > - Avadh > > On Fri, Dec 5, 2008 at 12:32 PM, Bala <[EMAIL PROTECTED]> wrote: > > I am trying to do a file upload from gwt-ext without bringing up the > dialog box. To do this, I created a FormPanel and added the > appropriate fields to it. Then did a form.submit(). This doesn't seem > to work. Any idea why? The code is shown below. > > final FormPanel uploadForm = new FormPanel(); > uploadForm.setVisible(false); > uploadForm.setFileUpload(true); > final TextField sourceFile = new TextField("File", "sourceFile"); > sourceFile.setVisible(false); > sourceFile.setInputType("file"); > sourceFile.setValue("/tmp/test.txt"); > > final TextField targetFile = new TextField("Upload As", "targetFile"); > targetFile.setVisible(false); > targetFile.setValue("different.txt"); > > uploadForm.add(sourceFile); > uploadForm.add(targetFile); > > final String url = GWT.getModuleBaseURL() + "/uploadFile"; > uploadForm.getForm().submit(url, null, Connection.POST, null, false); > > I tested the servlet on the server side with a simple html form and it > works correctly. Only the GWT-EXT version doesn't seem to work. > > Thanks, > Bala. > > > > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "GWT-Ext Developer Forum" 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/gwt-ext?hl=en -~----------~----~----~----~------~----~------~--~---
