09-17-2009 03:10 PM
How would I use MultipartPostData to build a request with fields containing binary data (as if uploading file from an html form) as well as text data? There was a previous thread that basically asked the same question, but there was no good answer--somehow setData(Object) is supposed to be used, but there's no documentation or examples of how to use it. A Google search didn't turn up anything useful, either. Would something like this work?
byte face; byte voice; // set face to some image data // set voice to some sound data MultipartPostData post = new MultipartPostData("UTF-8", true); post.append("name", "GI Joe"); post.append("face", null); post.setData(face); post.append("voice", null); post.setData(voice); // etc.
Moreover, how can we control the content-type of each part? How, for instance, could I build a request that had, say, image/png, audio/basic, application/octet-stream, and text/xml fields?
09-18-2009 12:57 PM - edited 09-18-2009 12:58 PM
I haven't used this myself but I know of someone who did use the following code for inspiration and got it working in his own app
09-18-2009 03:31 PM
That's a useful link. It shows how to implement a replacement for RIM's MultipartPostData class. It isn't an answer to the question I asked, but it is a solution to my problem!