hi i created a second form which will let be choose a file and then
there is a button for uploading the file which communicates with a
servlet for the upload. Here are the 2 sources:

Why the file doesnt upload? Any ideas? Anyone to give me a working
example?

package faceRecognition.client;

import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.FileUpload;
import com.google.gwt.user.client.ui.FormHandler;
import com.google.gwt.user.client.ui.FormPanel;
import com.google.gwt.user.client.ui.FormSubmitCompleteEvent;
import com.google.gwt.user.client.ui.FormSubmitEvent;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.VerticalPanel;

@SuppressWarnings("deprecation")
public class FormUpload extends Composite{

        final FormPanel form;
        final VerticalPanel vPanel;
        final FileUpload upload;

        public FormUpload(String user) {

                form = new FormPanel();
                form.setEncoding(FormPanel.ENCODING_MULTIPART);
                form.setMethod(FormPanel.METHOD_POST);
                form.addStyleName("table-center");
                form.addStyleName("demo-panel-padded");
                form.setWidth("275px");

                vPanel = new VerticalPanel();

                upload = new FileUpload();
                upload.setName("upload");
                vPanel.add(upload);

                vPanel.add(new HTML("<hr />"));

                vPanel.add(new Button("Submit", new ClickHandler()
                {

                        @Override
                        public void onClick(ClickEvent event) {
                                //form submit
                        }
                }));

                form.add(vPanel);

                initWidget(vPanel);

                form.setAction("/myfacerecognitionwa/upload");

                form.addFormHandler(new FormHandler()
                {
                        public void onSubmit(final FormSubmitEvent event)
                        {
                                Window.alert(event.toString());
                        }

                        public void onSubmitComplete(final 
FormSubmitCompleteEvent event)
                        {
                                Window.alert(event.getResults());
                        }
                });



        }

}



/*


SERVLET CODE


*/

package faceRecognition.client;

import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.FileUpload;
import com.google.gwt.user.client.ui.FormHandler;
import com.google.gwt.user.client.ui.FormPanel;
import com.google.gwt.user.client.ui.FormSubmitCompleteEvent;
import com.google.gwt.user.client.ui.FormSubmitEvent;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.VerticalPanel;

@SuppressWarnings("deprecation")
public class FormUpload extends Composite{

        final FormPanel form;
        final VerticalPanel vPanel;
        final FileUpload upload;

        public FormUpload(String user) {

                form = new FormPanel();
                form.setEncoding(FormPanel.ENCODING_MULTIPART);
                form.setMethod(FormPanel.METHOD_POST);
                form.addStyleName("table-center");
                form.addStyleName("demo-panel-padded");
                form.setWidth("275px");

                vPanel = new VerticalPanel();

                upload = new FileUpload();
                upload.setName("upload");
                vPanel.add(upload);

                vPanel.add(new HTML("<hr />"));

                vPanel.add(new Button("Submit", new ClickHandler()
                {

                        @Override
                        public void onClick(ClickEvent event) {
                                //form submit
                        }
                }));

                form.add(vPanel);

                initWidget(vPanel);

                form.setAction("/myfacerecognitionwa/upload");

                form.addFormHandler(new FormHandler()
                {
                        public void onSubmit(final FormSubmitEvent event)
                        {
                                Window.alert(event.toString());
                        }

                        public void onSubmitComplete(final 
FormSubmitCompleteEvent event)
                        {
                                Window.alert(event.getResults());
                        }
                });



        }

}
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to