Skip to main content

MultiPart Post with mobile Ajax

1 reply [Last post]
Joined: 2008-11-06


i tried to send data as multi part content from mobile phone up to my server. I use the mobile ajax framework. (grateful framework!)

The server side works fine. (i checked with browser upload), But I dont know, how use i PostData and Part class. How do i use boundary etc?
Is there everybody they have a example, how can i do this?


Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Joined: 2008-11-06


i have a solution.
For interest:
static final String BOUNDARY = "---7d43722015402c8---";

Arg[] inputArgs = {

Arg[] itemHeaders = {
new Arg("Content-Type", "image/png"),
new Arg("Content-Disposition", "form-data; name=\"upload_field\"; filename=\"file.png\"")
Part item = new Part(picture, itemHeaders);
Part[] parts = {item};

PostData multiPart = new PostData(parts, BOUNDARY);

Arg[] httpArgs = {
new Arg("Content-Type", "multipart/form-data;boundary=" + BOUNDARY)

String url = midlet.getAppProperty("myUrl");
Response response =, inputArgs, httpArgs, listener, multiPart);

hope this helps