upload an image and audio in One request in android

Just use the httpmime-4.0.jar and apache-mime4j-0.4.jar and set the entity as MultipartEntity.
you can use as many file as you want.

Here is the stuff,

HttpPost httpost = new HttpPost("url for upload file");

MultipartEntity entity = new MultipartEntity();
entity.addPart("myIdentifier", new StringBody("somevalue"));
entity.addPart("myImageFile", new FileBody(imageFile));
entity.addPart("myAudioFile", new FileBody(audioFile));

httpost.setEntity(entity);
HttpResponse response;
response = httpclient.execute(httpost);

and for php side you can use these entity identifier names "myImageFile" and "myAudioFile" and move these files in appropriate folder.

Leave a Comment