This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
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 ]
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
Joined: May 08, 2000
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