FileUpload widget trouble

38 views
Skip to first unread message

Victor Llorens

unread,
Mar 6, 2010, 2:20:40 PM3/6/10
to Google Web Toolkit
Hi all,

I have a FileUpload and a Button in a GridPanel.
Once Button is clicked I submit the form.

Analyzing HTTP Traffic, I can see that Post data is void... no file is
sent.

Does some body know what could be the reason?


I attach some info:

POST /TFC_Server_unstable/AppReceiver HTTP/1.1
Host: localhost:8080
Connection: keep-alive
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US)
AppleWebKit/532.5 (KHTML, like Gecko) Chrome/4.0.249.89 Safari/532.5
Referer: http://localhost:8080/TFC_Server_unstable/?gwt.codesvr=127.0.0.1:9997
Content-Length: 44
Cache-Control: max-age=0
Origin: http://localhost:8080
Content-Type: multipart/form-data; boundary=----
WebKitFormBoundary1I85m0l32DvdcUiI
Accept: application/xml,application/xhtml+xml,text/html;q=0.9,text/
plain;q=0.8,image/png,*/*;q=0.5
Accept-Encoding: gzip,deflate,sdch
Cookie: JSESSIONID=E576D094A24EE9FEF71DA7EF0FDC7801
Accept-Language: es-ES,es;q=0.8
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3

------WebKitFormBoundary1I85m0l32DvdcUiI--

Code:

Grid panel = new Grid(5,2);
final FormPanel form = new FormPanel();
form.setWidget(panel);


form.setEncoding(FormPanel.ENCODING_MULTIPART);
form.setMethod(FormPanel.METHOD_POST);
form.setAction("/TFC_Server_unstable/AppReceiver");


// Create a FileUpload widget.
FileUpload fuAppSrcZip = new FileUpload();
fuAppSrcZip.setName("uploadFile");
panel.setWidget(0,1,fuAppSrcZip);

btnPreviousStep = new Button("Previous Step");
btnNextStep = new Button("Upload and save everything");
btnNextStep.setEnabled(false);
panel.setWidget(1,0,btnPreviousStep);
panel.setWidget(1,1,btnNextStep);

add(panel);

// handlers

fuAppSrcZip.addChangeHandler(new ChangeHandler() {

@Override
public void onChange(ChangeEvent event) {
btnNextStep.setEnabled(true);
}
});

btnNextStep.addClickHandler(new ClickHandler() {

@Override
public void onClick(ClickEvent event) {
System.out.println(form.getAction());

form.submit();
}
});
btnPreviousStep.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
controller.previousStep();
}
});

// Add an event handler to the form.
form.addSubmitHandler(new SubmitHandler() {
@Override
public void onSubmit(SubmitEvent event) {
controller.aplicationSubmitStart();
}
});
form.addSubmitCompleteHandler(new
FormPanel.SubmitCompleteHandler() {
@Override
public void onSubmitComplete(SubmitCompleteEvent event) {
controller.applicationSubmitComplete();
}
});


Thnx in advance!

BimboJones

unread,
Mar 7, 2010, 10:51:04 AM3/7/10
to Google Web Toolkit
Hi,

Have you tried do the add(panel) after you assign the handlers?

Víctor Llorens Vilella

unread,
Mar 7, 2010, 2:19:50 PM3/7/10
to google-we...@googlegroups.com
Thanks Bimbo.

I have tried it with no luck.
I'm working with Chrome.

For testing, I have tried with Firefox and ,well..., submit button is doing anything.

Maybe is this widget buggy? I'm working, and may work with GWT 2.0.0.




--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To post to this group, send email to google-we...@googlegroups.com.
To unsubscribe from this group, send email to google-web-tool...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.




--
Victor Llorens Vilella

Martin Trummer

unread,
Mar 8, 2010, 8:25:43 AM3/8/10
to Google Web Toolkit
I guess you must add the fileupload to the form - not to the panel
so call: form.add(fuAppSrcZip);

On 7 Mrz., 20:19, Víctor Llorens Vilella <victor.llor...@gmail.com>
wrote:


> Thanks Bimbo.
>
> I have tried it with no luck.
> I'm working with Chrome.
>
> For testing, I have tried with Firefox and ,well..., submit button is doing
> anything.
>
> Maybe is this widget buggy? I'm working, and may work with GWT 2.0.0.
>

> > google-web-tool...@googlegroups.com<google-web-toolkit%2Bunsu...@googlegroups.com>

gp...@mac.com

unread,
Mar 19, 2010, 8:56:11 PM3/19/10
to Google Web Toolkit
FormPanel only takes a single widget (its a subclass of SimplePanel).
You have to add your form widgets to a single sub-panel (eg:
FlowPanel) and then add that to FormPanel.

Oh, BTW, I'm having the same problem w/ FileUpload. No file data gets
sent to the server. Sounds like a bug in GWT to me. Any ideas where to
find a solution?

On Mar 8, 6:25 am, Martin Trummer <martin.trum...@24act.at> wrote:
> I guess you must add thefileuploadto the form - not to the panel


> so call: form.add(fuAppSrcZip);
>
> On 7 Mrz., 20:19, Víctor Llorens Vilella <victor.llor...@gmail.com>
> wrote:
>
>
>
> > Thanks Bimbo.
>
> > I have tried it with no luck.
> > I'm working with Chrome.
>
> > For testing, I have tried with Firefox and ,well..., submit button is doing
> > anything.
>
> > Maybe is this widget buggy? I'm working, and may work with GWT 2.0.0.
>
> > On 7 March 2010 16:51, BimboJones <bimbojone...@gmail.com> wrote:
>
> > > Hi,
>
> > > Have you tried do the add(panel) after you assign the handlers?
>
> > > On 6 Mar, 19:20, Victor Llorens <victor.llor...@gmail.com> wrote:
> > > > Hi all,
>

> > > > I have aFileUploadand a Button in a GridPanel.

> > > google-web-tool...@googlegroups.com<google-web-toolkit%2Bunsubs cr...@googlegroups.com>

malliseven.hills

unread,
Mar 22, 2010, 2:18:31 AM3/22/10
to google-we...@googlegroups.com
Hi,

i think the following links would be help full for  you :

http://java-malli.blogspot.com/2010/03/gwt-upload-file.html  (Client Side).

http://java-malli.blogspot.com/2010/03/file-upload-server-side.html  (sever side   i'm using Spread Sheet Loading ).

Thanks,
Malli.



To unsubscribe from this group, send email to google-web-tool...@googlegroups.com.

Manuel Carrasco Moñino

unread,
Apr 6, 2010, 6:53:22 PM4/6/10
to google-we...@googlegroups.com
I dont think it is a GWT issue, try to use gwtupload library, it
simplifies a lot the code and adds cool features.

Manolo

BimboJones

unread,
Apr 7, 2010, 6:32:05 AM4/7/10
to Google Web Toolkit
Hi Manolo, does it work with App Engine? Specially the progressbar
stuff, thanks

On 6 Abr, 23:53, Manuel Carrasco Moñino <man...@apache.org> wrote:
> I dont think it is a GWT issue, try to use gwtupload library, it
> simplifies a lot the code and adds cool features.
>
> Manolo
>
> On Mon, Mar 22, 2010 at 7:18 AM, malliseven.hills
>

> <malliseven.hi...@gmail.com> wrote:
> > Hi,
>
> > i think the following links would be help full for  you :
>
> >http://java-malli.blogspot.com/2010/03/gwt-upload-file.html (Client Side).
>
> >http://java-malli.blogspot.com/2010/03/file-upload-server-side.html (sever
> > side   i'm using Spread Sheet Loading ).
>
> > Thanks,
> > Malli.
>

Manuel Carrasco Moñino

unread,
Apr 7, 2010, 5:45:28 PM4/7/10
to google-we...@googlegroups.com
Yes, version 0.5.7 works with App-Engine (use
AppEngineUploadServlet), but there are a bunch of issues,

- Because GAE doesn't support writing to file-system, the servlet
stores fileitems in memory using MemoryFileItemFactory.
- Then you have to make it persistent, but there are a limitation of
blob fields to 1024KB
- There is a limitation in the request size, so you can not upload a
file greater than 512, so upload goes fast and you will not see the
progress bar.
- The time spent to process a request is limited, so you can not use
sleep in server side to view the progress.

Nevertheless, you could use the library in order to simplify your code.

-Manolo

Reply all
Reply to author
Forward
0 new messages