Hi,

I have a problem in reading upload XML file from UI using fileupload
widget. I implement the XML parsing in FormPanel onSubmitComplete
method but it didn't find the file. How can I read an xml file coming
from user and upload in public folder then parse the content? So far
this is all I got.

uploadForm.addFormHandler(new FormHandler() {

                        public void onSubmit(FormSubmitEvent event) {
                                String xmlFile = fileUpload.getFilename();
                                //Getting the filename in the upload
                                if (fileUpload.getFilename().endsWith("xml")) {

                                        int slash = xmlFile.lastIndexOf("/");
                                        if(slash == -1){
                                                slash = 
xmlFile.lastIndexOf("\\");
                                        }

                                        if(slash != -1){
                                                xmlFile = 
xmlFile.substring(slash + 1);
                                        }
                                }
                                Window.alert(xmlFile);

                                if (fileUpload.getFilename().length() == 0) {
                                        Window.alert("You did not specify a 
filename!" );

                                }
                        }

                        public void onSubmitComplete(FormSubmitCompleteEvent 
event) {

                                GWT.log(event.getResults(), null);


                                String xmlFile = fileUpload.getFilename();
                                //Getting the filename in the upload
                                if (fileUpload.getFilename().endsWith("xml")) {

                                        int slash = xmlFile.lastIndexOf("/");
                                        if(slash == -1){
                                                slash = 
xmlFile.lastIndexOf("\\");
                                        }

                                        if(slash != -1){
                                                xmlFile = 
xmlFile.substring(slash + 1);
                                        }

                                }

                                setParser(new XMLParseUtil(xmlFile)); //parse 
the file

                        }
                });
--~--~---------~--~----~------------~-------~--~----~
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-Web-Toolkit@googlegroups.com
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