You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hc.apache.org by "Rustad, Aaron" <AR...@Online-can.com> on 2003/12/08 19:07:24 UTC
Problems Upload a file.
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: commons-httpclient-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-httpclient-dev-help@jakarta.apache.org
Re: Problems Upload a file.
Posted by Oleg Kalnichevski <ol...@apache.org>.
Aaron,
Could you please produce a wirelog of the HTTP session that exhibits the
problem? See HttpClient logging guide for details on logging options in
HttpClient <http://jakarta.apache.org/commons/httpclient/logging.html>
Cheers
Oleg
On Mon, 2003-12-08 at 19:07, Rustad, Aaron wrote:
> 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: commons-httpclient-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-httpclient-dev-help@jakarta.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-httpclient-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-httpclient-dev-help@jakarta.apache.org
Re: Upload large files-enhancement
Posted by Sid Subr <si...@yahoo.com>.
I wish I could but that does not seem to be an
option.. as the web server is a part of this other
product we use..
tough luck..
yeah I know..
Merry Christmas to everyone..
Sid
--- Ortwin_Gl�ck <or...@nose.ch> wrote:
> Sid Subr wrote:
>
> > reason for this mail:
> >
> > I am having to work with a web server which deos
> not
> > understand the 100-continue header and as a result
> am
> > having problem uploading large files as the server
> > closes the connection before the entire content is
> > transmitted. A change for this has been addressed
> in
> > the Bugzilla as an enhancement (bug #14036).
>
> I guess it's time for you to switch to a different
> web server product.
>
> :-)
>
> merry xmas
>
> Odi
>
>
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
>
commons-httpclient-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail:
> commons-httpclient-dev-help@jakarta.apache.org
>
__________________________________
Do you Yahoo!?
New Yahoo! Photos - easier uploading and sharing.
http://photos.yahoo.com/
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-httpclient-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-httpclient-dev-help@jakarta.apache.org
Re: Upload large files-enhancement
Posted by Ortwin Glück <or...@nose.ch>.
Sid Subr wrote:
> reason for this mail:
>
> I am having to work with a web server which deos not
> understand the 100-continue header and as a result am
> having problem uploading large files as the server
> closes the connection before the entire content is
> transmitted. A change for this has been addressed in
> the Bugzilla as an enhancement (bug #14036).
I guess it's time for you to switch to a different web server product.
:-)
merry xmas
Odi
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-httpclient-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-httpclient-dev-help@jakarta.apache.org
Upload large files-enhancement
Posted by Sid Subr <si...@yahoo.com>.
reason for this mail:
I am having to work with a web server which deos not
understand the 100-continue header and as a result am
having problem uploading large files as the server
closes the connection before the entire content is
transmitted. A change for this has been addressed in
the Bugzilla as an enhancement (bug #14036).
I cannot do what I am doing without
a) this enhancement on the httpclient side
b) making the web server guys support the 100-continue
the former seemed to be the point to start so, if any
one is in the same boat as I am can they please either
a) provide insight into what they did for this problem
or
b) vote for this enhancement to be included in some of
the changes that are going on in the new releases for
the httpclient.
Thank you,
Sid
__________________________________
Do you Yahoo!?
Protect your identity with Yahoo! Mail AddressGuard
http://antispam.yahoo.com/whatsnewfree
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-httpclient-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-httpclient-dev-help@jakarta.apache.org