On Tue, 2013-04-09 at 16:37 +0300, Nir Dweck wrote:
> Hi,
> I am trying to receive a multipart entity at my http server and am having
> trouble to parse it.
> The request includes a header:
> Content-Type: multipart/form-data;
> boundary=-------------------------acebdf13572468
> my code does the following:
> BasicHttpEntity entity = (BasicHttpEntity)entityReq.getEntity();
> long len = entity.getContentLength();
> byte[] data = new byte[(int)len];
> int read = entity.getContent().read(data, 0, (int)len);
> 
> and when I look at the the read bytes they hold:
> includes a BasicHttpEntity and when I read it I see the content is:
> ---------------------------acebdf13572468
> Content-Disposition: form-data; name="file";
> filename="Data-Did_2013-03-03_06-05-15-6352000_Fid_114.plf"
> Content-Type: application/octet-stream
> 
> ‰
> 
> I actually need the bytes in the sent file.
> Can someone send me a short code example on how to do it?
> Regards,
> Nir

Nir

HttpClient does not provide a mime parser. You should consider using
either Commons Upload [1] or Mime4j [2] to parse multipart content on
the server side.

Oleg 

[1] http://commons.apache.org/proper/commons-fileupload/
[2] http://james.apache.org/mime4j/index.html


---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-users-unsubscr...@hc.apache.org
For additional commands, e-mail: httpclient-users-h...@hc.apache.org

Reply via email to