
Signature
Unemployed English Java programmer
http://jroller.com/page/tackline/
> > I created a servlet that successfully gets the file using HTML input
> > type=file and saves it on the server. Now i also want to send some
[quoted text clipped - 8 lines]
>
> Tom Hawtin
Hi Tom,
You mean to say, put the hidden fields above the form tag in HTML part,
is that so.
Also, I am not sure if that is an issue.
I have seen code earlier during maintenance, in which.
1. The hidden fields <input type="hidden" name="myname"
value="myvalue"> are at the bottom of the file.
2. The values are set by javascript code.
3. The servlet that is the target of the form is able to read the
hidden values.
I was using servlet 2.0/2.1 specs, not the current 2.4.
Thanks.
adamspe@gmail.com - 21 Nov 2005 20:08 GMT
what he's saying is:
<form method="POST" action="..." enctype="multipart/form-data">
<input type="hidden" ...>
<input type="file" ...>
<input type="submit" ... />
</form>
instead of:
<form method="POST" action="..." enctype="multipart/form-data">
<input type="file" ... />
<input type="hidden" ... />
<input type="submit" ... />
</form>
The order of the inputs in the form also dictates the order of the data
on the multipart stream posted to the server. For a servlet engine to
support reading of basic form input when a file precedes it on the
stream would require that the file be read off of the stream to get at
the next body part. Doing so automatically by a servlet engine is not
a particularly scalable possibility. As such I think it's pretty
common that an implementation only read form data off of the multipart
stream up to the first body part with a file content-disposition and
stop there. Only making available to the getParameter method
parameters either explicitly on the query args or in input preceding
the first file.
Madni - 22 Nov 2005 05:00 GMT
Dear ALL,
Thanks for positive response from all u guys ...I tried Thomas Hawtin
suggestion but unfortunately that didnt work .Any ways here is the
piece of code
<form id=form1 ENCTYPE="multipart/form-data" name=form1
action="http://192.168.0.132:8001/servlet/UploadTest" METHOD="POST"
onsubmit="return
oWESFWCoordinator.getObject('oUploadFile').validations();" >
......
......
<td class=label>Select the File: </td>
<input type=file NAME="File1" class=contentinput id=filepath
name=filepath maxlength=410 ></td>
<td><input type=text id=directory name="directory" > <input
type="button" class = configurationbutton value="Browse..."
id=btnSaveAs name=btnSaveAs
onclick="oWESFWCoordinator.getObject('oUploadFile').openWesBrowser()">
</td>
<td ><input type=text id="path" name="path" style="visibility:
hidden;"></td>
</table>
what i explored is , when I write hidden field above the file ... java
console (where i was looking for lot many System.out.println ....) was
showing that information(posted using hidden fields) prefixed with the
starting boundary of the file .(As u guys know each file is wrapped by
a boundary ,showing the file start and end ) ....
Similarly when i placed the hidden fields below the <input type = file
....> , that hidden field values were then seen to be postfixed with
the closing boundary of the file .So i decided to parse the file string
, extract its boundary , and separating the value posted via hidden
field... Thats gonna get worked .
Again I would like to thank all you guys for helping me a lot ...God
bless u all
Best Regards ,
Madni