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"]
.