cURL / Mailing Lists / curl-library / Single Mail

curl-library

How can i use curl_formadd or any other function to http post a file without inserting "boundary" tags in html headers?

From: shivpratap <shivpratap_chauhan_at_persistent.co.in>
Date: Tue, 18 Sep 2007 14:29:03 +0530

Hi All,

How can i use curl_formadd or any other function to http post a file
without inserting "boundary" tags in html headers?

This is the code to send a file:

URL *curl;
 CURLcode res;

   struct curl_httppost *formpost=NULL;
   struct curl_httppost *lastptr=NULL;
   struct curl_slist *headerlist=NULL;
   char buf[] = "Expect:";

curl_global_init(CURL_GLOBAL_ALL);
curl_formadd(&formpost,&lastptr,CURLFORM_COPYNAME,
"temp1.xml",CURLFORM_FILECONTENT, temp_pathname,CURLFORM_END);

curl = curl_easy_init();
if(curl)
{
    curl_easy_setopt(curl, CURLOPT_URL, server_address);
     curl_easy_setopt(curl, CURLOPT_HTTPPOST, formpost);
     res = curl_easy_perform(curl);
     curl_easy_cleanup(curl);
     curl_formfree(formpost);
     curl_slist_free_all (headerlist);
   }

This is the http request generated, that have been intercepted by
"tcpmon" utility.

POST /cms/remote/email-inject HTTP/1.1
Host: 192.168.2.213:8084
Pragma: no-cache
Accept: */*
Content-Length: 3702
Expect: 100-continue
Content-Type: multipart/form-data;
boundary=----------------------------5856b4d0d088

------------------------------5856b4d0d088
< Here are the Contents of the xml file >
------------------------------5856b4d0d088--

Here boundary tag in red, This should not appear in http post request.
How could i made to send http post file without adding these boundary
tags.

Any help will be appreciated.

--
Thanks,
-shiv
DISCLAIMER
==========
This e-mail may contain privileged and confidential information which is the property of Persistent Systems Pvt. Ltd. It is intended only for the use of the individual or entity to which it is addressed. If you are not the intended recipient, you are not authorized to read, retain, copy, print, distribute or use this message. If you have received this communication in error, please notify the sender and delete all copies of this message. Persistent Systems Pvt. Ltd. does not accept any liability for virus infected mails.
Received on 2007-09-18