I need to send a java object and a file via HTTP in a single HTTP request. I am facing following issue:
I am using org.apache.commons.httpclient.HttpClient implementation for this and the problem is the servlet on the server side expects the multipart request as mentioned in the request and hence the Object whic开发者_如何学Goh I send as a byte[] stream gets corrupted. If I just either file or object in a single request then this works fine.
Have you tried this tutorial: http://evgenyg.wordpress.com/2010/05/01/uploading-files-multipart-post-apache/ ?
精彩评论