You are viewing a plain text version of this content. The canonical link for it is here.
Posted to httpclient-users@hc.apache.org by "Burke Even, RealityImages.com" <bu...@realityimages.com> on 2005/01/06 18:05:11 UTC
multipart post and input type
I'm trying to upload jpg files to an existing php script on the server,
without using a java servlet. Am I correct in assuming HttpClient can do
this? If so, please read on...
My problem: how do I add the equivalent of <input type="file"
name="fileUpload"> to the upload?
The php script on the server uses fileUpload as the temporary location and
name of the uploaded file, but when I use the example
MultipartFileUploadApp.java to upload a file, fileUpload is blank, so the
php script has nothing to work with.
I've looked in MultipartPostMethod.java at the three versions of
addParameter() but none take three string parameters, which being a newbie
is as far as I can get at this point.
Any help would be appreciated!
Burke
---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpclient-user-help@jakarta.apache.org
RE: multipart post and input type
Posted by "Burke Even, RealityImages.com" <bu...@realityimages.com>.
Julius!
Thanks a HEAP - FilePart and addPart did the trick!
I'm a little fuzzy on 'how it works', but now that I have a working example
I hope my learning curve will pick up a little.
Thanks again!
Burke
---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpclient-user-help@jakarta.apache.org
Re: multipart post and input type
Posted by Julius Davies <ju...@cucbc.com>.
Hi, Burke,
I haven't used this feature of HTTPClient, but I suspect it works like
this:
File f = new File( "/tmp/myImage.jpg" );
FilePart fp = new FilePart( "fileUpload", f, "image/jpeg", null );
MultipartPostMethod m = new MultipartPostMethod( "http://upload.com/" );
m.addPart( fp );
yours,
Julius
On Thu, 2005-06-01 at 12:05 -0500, Burke Even, RealityImages.com wrote:
> I'm trying to upload jpg files to an existing php script on the server,
> without using a java servlet. Am I correct in assuming HttpClient can do
> this? If so, please read on...
>
> My problem: how do I add the equivalent of <input type="file"
> name="fileUpload"> to the upload?
>
> The php script on the server uses fileUpload as the temporary location and
> name of the uploaded file, but when I use the example
> MultipartFileUploadApp.java to upload a file, fileUpload is blank, so the
> php script has nothing to work with.
>
> I've looked in MultipartPostMethod.java at the three versions of
> addParameter() but none take three string parameters, which being a newbie
> is as far as I can get at this point.
>
> Any help would be appreciated!
>
>
> Burke
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: httpclient-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: httpclient-user-help@jakarta.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpclient-user-help@jakarta.apache.org