IntelliJ Java IDE
The moose likes HTML, CSS and JavaScript and the fly likes upload file + other form input values Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of Practical Unit Testing with TestNG and Mockito this week in the Testing forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Reply Bookmark "upload file + other form input values" Watch "upload file + other form input values" New topic
Author

upload file + other form input values

Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
hi.
I have been loading a .doc file , but also I need to have some hidden form values to be appended. I currently cannot manage this. is there a trick to append these form names-value pairs to the .doc file and then process @ the server side and separate?
kind Regards,
Bear Bibeault
Author and opinionated walrus
Marshal

Joined: Jan 10, 2002
Posts: 50677

Obviously adding request parameters to the Word document itself makes no sense.
What exactly are you doing? You weren't very clear.
If you are uploading the Word document to the server by submitting a multi-part form and the "file" input element, you can add parameters to the form element (hidden or otherwise) which will then be submitted to the server along with the file.
Note that if you are using a servlet to process the file on the server, you cannot get these parameters using the "normal" request.getParameter() mechanism (which cannot deal with multi-part forms).
hth,
bear


[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
Ja, actually that was my problem. I cannot get the hidden form parameter values @ the servlet side. That is why I have asked this question.
ciao,
c.g.
Bear Bibeault
Author and opinionated walrus
Marshal

Joined: Jan 10, 2002
Posts: 50677

More info needed.
Are you parsing the multi-part form yourself? Are you using a 3rd-party package (such as oreilly.com)?
Because the HttpServletRequest mechanism doesn't deal with multi-part forms, you need to parse out the parameters yourself.
Most pre-written upload packages do this for you, and all you need to do is to figure out the API to get to that info.
hth,
bear
P.S. This isn't an HTML/Javascript question at all. Perhaps we should mosey along to the Servlets forum...
[ May 19, 2003: Message edited by: Bear Bibeault ]
Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
I have searched a little more, and ja I found oreilly package.
now another problem arises: i put the "cos.jar" file into WEB-INF/lib/ directory %& also added that file to the global classpath. but while compiling the servlet, the package contents cannot be reached.(IDE i am using Sun ONE) what advice could you give me in this case?
 
jQuery in Action, 2nd edition
 
subject: upload file + other form input values
 
Threads others viewed
show file to user
show file to user
how to upload file along with HTML form data
FileUpload- Can't write on server
How to convert a .doc file to .txt file
developer file tools