great...Thanks mon3y for your help.. it worked.
thanks
zujee

On Mar 8, 2:21 pm, mon3y <[email protected]> wrote:
> What i do is i add hidden inputs to the form i'm submitting along with
> my picture, like so....
>
> private Hidden formTime = new Hidden();
> private HorizontalPanel formHP=new HorizontalPanel();
> public FormPanel uploadForm=new FormPanel();//form
>
> formTime.setName("time");
> formTime.setValue(""+picTime);
> formHP.add(formTime);
> uploadForm.add(formHP);
>
> then on the server.....something along these lines.....
>
> public synchronized void doPost(HttpServletRequest request,
> HttpServletResponse res)throws ServletException, IOException{
>                 res.setContentType("text/html;charset=utf-8");
>
>                 item=null;
>
>                 //System.err.println("selectMstsq: "+selectMstsq);
>                 if(myWeb==null)myWeb=new PictureUploadServer();
>
>                 File tempFolder =
> (File)request.getSession().getServletContext().getAttribute("com.google.gwt­.dev.shell.outdir");
>
>                 //Check that we have a file upload request
>                 boolean isMultipart = 
> ServletFileUpload.isMultipartContent(request);
>
>                 // Create a factory for disk-based file items
>                 FileItemFactory factory = new DiskFileItemFactory();
>
>                 // Create a new file upload handler
>                 ServletFileUpload upload = new ServletFileUpload(factory);
>
>                 // Parse the request
>                 items = new LinkedList();
>
>                 try {
>                         items = upload.parseRequest(request);
>
>                 } catch (FileUploadException e) {
>                         // TODO Auto-generated catch block
>                         e.printStackTrace();
>                 }
>
>                 iter = items.iterator();
>
>                 while (iter.hasNext()) {
>                         item = (FileItem) iter.next();
>                         String name = item.getFieldName();
>                         if(name.compareTo("time") == 0){
>                                 picTime=Long.parseLong(item.getString());
>                         }else if(name.startsWith("picture")){
>                                 uploadedStream = item.getInputStream();
>                                 /* This is to dump the upload to disk (create 
> file)
>                                  * To keep in memory, change the output 
> stream to
>                                  * ByteArrayOutputStream, writing file 
> contents
>                                  * into a byte array.
>                                  * This byte array can be used as input to a 
> ByteInputSream
>                                  * which in turn can be written to 
> javax.sql.InputStream
>                                  */
>                         }
>                 }
>         }
>
> Hope that spoon feeding has filled you up, :).
>
> On Mar 8, 8:12 am, zujee <[email protected]> wrote:
>
>
>
> > Hi,
> > How can i add parameter in FileUpload in the formPanel. I successfully
> > uploaded the file to server. But I want to pass some string values
> > along with the  uploadForm.submit(); .
>
> > How can I do that.
> > Thanks in advance
> > zuje- Hide quoted text -
>
> - Show quoted text -

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