Quantcast
Channel: beginners - openFrameworks
Viewing all articles
Browse latest Browse all 4929

How to make an http POST to fill a multiform and upload a file (ofxHttpUtils & ofxHTTP)

$
0
0

@moebiussurfing wrote:

Hi all,
I want to fill this html multiform to upload a file:

<html>
<form enctype="multipart/form-data" method="post" action="/writexml/">

  <label for="id_title">Title:</label><input id="id_title" name="title" type="text" />
  <label for="id_xml">Xml:</label><input id="id_xml" name="xml" type="file" />
  <input type="submit">

</form>
</html>

On the web browser I just need to fill a chosen name, pick a file and click send.
I tried with ofxHttpUtils from @arturo but the server do not receive nothing filled, and it replays that all fields are required.
My code looks like the included on the example:

ofxHttpForm form;
form.action = "https://test1-manumolinaz.c9.io/writexml/";
form.method = OFX_HTTP_POST;
form.addFormField("id_title", "fill with text name");
form.addFile("id_xml","filename.xml");
httpUtils.addForm(form);

I can't figure out how to make it work. I have seen other related posts like this one:

Maybe I can try to make it work with ofxHTTP from @bakercp, like he explains on the above post link, but is hard to understand with my beginner level.

Anyone has any helping tip?

EDIT: I tried too without success:

form.addFormField("title", "fill with text name");
form.addFile("xml","filename.xml");

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 4929

Trending Articles