cURL / Mailing Lists / curl-library / Single Mail

curl-library

Sending xml file using POST method

From: <Perreault.Marc_at_hydro.qc.ca>
Date: Tue, 10 Feb 2009 10:13:05 -0500

Hi all
 
I'm trying to send an XML file to a HTTP application server using the
POST method through the C API. I use
CONTENTTYPE="application/x-www-form-urlencoded" but it seems that curl
overrides my selection and set it to "multipart/form-data". On the
server side, the data is OK but it starts with a header like this:
 
------------------------------aa4ede2b4649
Content-Disposition: form-data; name="IntrantsXml";
filename="/home/cr4025/test_curl/IntrantsXml.xml"
Content-Type: application/x-www-form-urlencoded

Here is part of my C code:

  curl_formadd(&formpost,
               &lastptr,
               CURLFORM_COPYNAME, "IntrantsXml",
               CURLFORM_FILE, inputfile,
               CURLFORM_CONTENTTYPE,
"application/x-www-form-urlencoded",
               CURLFORM_END);

How can I force the data to be received intact without this
Content-Disposition stuff at the beginning of my XML data.

Thanks
Marc Perreault
Received on 2009-02-10