Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Upload using O'Reilly package

 
Adrian Muscalu
Ranch Hand
Posts: 73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Given this html form,
,
it seems that when I try to get the value of 'aText' in the servlet returns an empty String.
My question is:
is this behaviour normal? Once the enctype is multipart/form-data I cannot send some description of the file in the same request object?
Thank you,
Adrian
[ December 18, 2002: Message edited by: Adrian Muscalu ]
[ December 18, 2002: Message edited by: Adrian Muscalu ]
 
heiner weilandt
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,
you have to ask the multipart if the next part is an file or a parameter. then you put the parameter in an hashtable (or work with it directly) and the file in an uploaddirectory or something else.

this is an example to upload the file in UPLOADDIR and put the parameter in a hashtable. the hashtable is the reuturn of this method.
i hope this helps
 
Adrian Muscalu
Ranch Hand
Posts: 73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you for your help,
the example works just fine. I've tried to save the FilePart object in the hashtable for future actions but it doesn't work. It is affected somehow and the uploaded file ends up with 0Kb.
Could this be a bug in O'Reilly's package?
Again, if I save the file into the while statement it works OK. However, it is not practical if you want to have a "conditional" upload, depending on the parameters retreieved from the same request object.
Thank you,
Adrian
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic