Tell me more ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

I have a PHP file which takes as input a file and one or more vars, all given by post method.
I have to do a HTTP POST Request in Android to that PHP file, sending it file (image) and vars.
I know how to send only the file (post file) or the data/vars (post data), but how can I modify these snippets to do both actions (send file + send data) on the same request?
Thanks

Edit: The sending form is something about this:

<form action="receive.php" method="post" enctype="multipart/form-data">
    <p><input type="file" name="file" id="file" /></p>
    <p><input name="firstVar" type="text" /></p>
    <p><input name="secondVar" type="text" /></p>
    <p><input type="submit" value="send" /></p>
</form>

So, in receiving side, I will have my vars on $_POST["firstVar"] and $_POST["secondVar"], and the uploaded file on $_FILES["file"].

share|improve this question
1  
show us the form. but the regular form data will be in the $_POST\$_GET var and the file date in the $_FILES var –  Dagon Jun 17 '12 at 20:03
 
Why do you need a php form for an android request? –  MichaƂ K Jun 17 '12 at 21:03
1  
@michal they're asking how to send from Android to a website (the fact it's PHP irrelevant) –  therefromhere Jun 17 '12 at 21:13
 
possible duplicate of Post multipart request with Android SDK –  therefromhere Jun 17 '12 at 21:40

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.