hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Rustad, Aaron" <ARus...@Online-can.com>
Subject Problems Upload a file.
Date Mon, 08 Dec 2003 18:07:24 GMT
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", 
FilePart filePart = new FilePart("input-data", partSource);

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">
    <td>From: </td>
    <td><input type="text" name="from" value="asdf"/></td>

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

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

Any help is greatly appreciated.

To unsubscribe, e-mail: commons-httpclient-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-httpclient-dev-help@jakarta.apache.org

View raw message