File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Servlets and the fly likes Upload using O'Reilly package Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Upload using O Watch "Upload using O New topic
Author

Upload using O'Reilly package

Adrian Muscalu
Ranch Hand

Joined: May 08, 2000
Posts: 73
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 ]

SCJP2, SCWCD
heiner weilandt
Ranch Hand

Joined: Sep 10, 2002
Posts: 46
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

Joined: May 08, 2000
Posts: 73
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
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Upload using O'Reilly package