Here code in server (example.php):
< ?php

$target_path = "uploads/";

$target_path = $target_path . basename( $_FILES['myFile']['name']);

if(move_uploaded_file($_FILES['myFile']['tmp_name'], $target_path)) {
echo "The file ". basename( $_FILES['myFile']['name']).
" has been uploaded";
} else{
echo "There was an error uploading the file, please try again!";
}

//Text
echo $_POST['textData'];

? >

"I hope this helps"




On Sep 12, 8:43 am, David Tiago <davidtiagoconcei...@gmail.com> wrote:
> Hello,
>
> I would like to develop an application that uploads an image and some
> text data about that image.
> To do that, I am trying to create a HTTP Multipart Post, as follows:
> [code]
> HttpClient client = new DefaultHttpClient();
> HttpPost post = new HttpPost("servlet address");
> FileBody file = new FileBody(new File("image file"));
> StringBody text = new StringBody("text data");
> MultipartEntity reqEntity = new
> MultipartEntity(HttpMultipartMode.BROWSER_COMPATIBLE);
> reqEntity.addPart("myFile", file);
> reqEntity.addPart("textData", text);
> [/code]
>
> My doubt is: how can I extract those values in the server? I would
> like to develop a Servlet to receive and process the post requests. In
> this Servlet I would need to extract these values in th request.
> Can you help me?
> Do you have any sample of server to answer the android multipart
> requests?

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to