hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Roland Weber <ROLWE...@de.ibm.com>
Subject Re: how do u simulate sending a blank file field with httpclient?
Date Mon, 07 Mar 2005 08:12:53 GMT
Hello Steve,

you can implement a PartSource that returns 0 as the
content length, an empty string as the file name, and
ByteArrayInputStream(new byte[0]) as the InputStream.

And yes, it does make sense.

hope that helps,
  Roland




rts4uad02@sneakemail.com 
06.03.2005 22:09
Please respond to
"HttpClient User Discussion"


To
httpclient-user@jakarta.apache.org
cc

Subject
how do u simulate sending a blank file field with httpclient?






Ive been trying to figure out how to send a blank file field with 
httpclient.

Ive managed to work out how to use the multipartform encoded http post and 
can send a file ok, but what i would like to do is to be able to post a 
filepart but not actually send a file, which would simulate a person 
submitting a form that includes a file field, but they havent actually 
chosen a file to submit. 

i hope that makes sense?

the actual http headers that are submitted when no file is selected and 
the form is submitted looks something like this:

----------
Content-Disposition: form-data; name="SomeFile"; filename=""
Content-Type: application/octet-stream
-----------

i have tried things like creating a null file for the filepart or making 
the filename "", but both these methods caused an exception to be thrown.

does anyone know the correct way of doing this? 

cheers,

steve

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



Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message