HTTP FORM POST with mixed data - multipart/form-data

pawelmic

Member
Licensed User
Longtime User
Hi, I have been trying to figure this out for over a week now: how do I perform HTTP FORM POST with mixed data (multipart/form-data)?

- I've searched this forum on how to do HTTP FORM POST and tried many different examples, they all work, which is great!

- I was able to do POST with string values, and I was able to do POST with a picture (or a file) ... BUT separately

The web site for which I'm writing my app is requesting that I send both at the same time (multipart/form-data), therefore I need to be able to perform HTTP FORM POST with mixed data, all in one call. I don't have access to the web site's PHP code and they use the same thing for uploads from different devices (so there won't be any special modifications for me). Here is their specification:

"Please submit the information using HTML POST using multipart/form-data"

HTML:
<form method="POST" enctype="multipart/form-data" name="image_upload_form" action="http://somewebsite.com/web.php">
<p><input type="hidden" name="MAX_FILE_SIZE" value="1000000" /></p>
<p><input type="text" name="name" id="name" maxlength="40" />&nbsp<span>name</span></p>
<p><input type="text" name="desc" id="desc" maxlength="160" />&nbsp<span>description</span></p>
<p><input type="text" name="lat" id="lat" maxlength="40" />&nbsp<span>lat</span></p>
<p><input type="text" name="lng" id="lng" maxlength="40" />&nbsp<span>lng</span></p>
<p><input type="text" name="email" id="email" maxlength="40" />&nbsp<span>email</span></p>
<p><input type="text" name="device" id="device" maxlength="40" />&nbsp<span>device</span></p>
<p><input type="file" name="image_file" id="image_file" size="20">&nbsp<span>image_file</span></p>
<p><input type="submit" value="Submit" name="action"><input type=reset></p>
</form>

Any help would be greatly appreciated as this is the only thing stalling my app release! :BangHead:
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…