Thanks for the answer. The advice to use the methods provided by
Apache FileUpload was right. You know what field you are processing by
making the query: fileItem.getFieldName()
List items = null;
try{ items = upload.parseRequest(request); } catch( Exception e)
{e.printStackTrace();}
Iterator it = items.iterator();
while( it.hasNext() ) {
FileItem fileItem = (FileItem) it.next();
System.out.println( fileItem.getFieldName() + " -- " +
fileItem.getString() );
}
E.g. Sending an image that has the name "myImage" is set on the client
side by
myFileUpload.setName("MyImage");
but also you can set another field:
new Hidden( "HiddenFieldName", "TheValueIWantToSubmit" );
On the server side the output of System.out.println will look
something like this:
MyImage -- jasfga...( This is the image data as a string, not
readable)
HiddenFieldName -- TheValueIWantToSubmit
By swaping the order of the fields in the client side code, the output
on the server will also be swapped.
On 6 Sep., 14:16, Thomas Broyer <[EMAIL PROTECTED]> wrote:
> On 6 sep, 11:03, Paul van Hoven <[EMAIL PROTECTED]> wrote:
>
> > I've a fileupload that works fine. But I need to add additional
> > information to the data that is being uploaded. I have a string object
> > that also must be sent to the server.
> > So I tried this here:
>
> > client side:
>
> > FormPanel form = new FormPanel();
> > ...
> > uploadPanel.add( new HTML("<input type=\"hidden\" name=
> > \"userIdentification\" value=\"" + userIdentification + "\" />") );
>
> uploadPanel.add(new Hidden("userIdentification", userIdentification));
>
> > Enumeration names = request.getParameterNames();
>
> Isn't getParameterName only dealing with the query-string and
> application/x-www-form-urlencoded data?
>
> If you're using multipart/form-data, I'd say you have to use e.g.
> apache commons-fileupload to access both the files *and* "data
> fields".
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---