I am trying up upload a file to a servlet, but I am not sure that it is working as it should. I hope that someone out there can point out what/if I am doing wrong.

I have this code that uses HTTPClient 2.0r2:

ByteArrayPartSource partSource = new ByteArrayPartSource("file.txt", theBytes);
FilePart filePart = new FilePart("input-data", partSource);
mpPostMethod.addPart(filePart);


But when it hits the servlet (with the above code), the "input-data" is considered a simple form field.
When a use a form that is embedded into a web page(see below), it is not a form field.


<form action="./upload.do" enctype="multipart/form-data" method="POST">
<table width="75%" border="1">
 <tr>
   <td>From: </td>
   <td><input type="text" name="from" value="asdf"/></td>
 </tr>

<tr>
<td>To: </td>
<td><input type="text" name="to" value="qwer"/></td>
</tr>
<tr>
<td>Version: </td>
<td><input type="text" name="version" value="1.5"/></td>
</tr> <tr>


   <td>File: </td>
   <td><input type="file" name="input-data" value="C:\\demon.gif"></td>
 </tr>
</table>
<input type="submit" value="Submit"/>
</form>

Any help is greatly appreciated.
Thanks!
Aaron.



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to