cURL / Mailing Lists / curl-library / Single Mail


receiving file sent with CURLOPT_PUT

From: Superprops <>
Date: Fri, 13 Feb 2009 16:45:52 -0800

Hopefully I've asked this question in the right place.

My c application (on win32) is communicating well with my website using
CURLOPT_POSTFIELDS, but now I want to send a file using the sample code
provided so generously as httpput.c. My question is how do I receive
the data on the server side ?

With plain text, I received it via $_POST vars:

c program snippet: (sending)

curl_easy_setopt(hcurl, CURLOPT_POSTFIELDS, "test=success");

php snippet: (receiving)

   $testvar = $_POST['test'];

Now, how would I do this with an actual file, or do I need to do
anything at all since I specify CURLOPT_URL ?

c snippets:
curl_easy_setopt(curl, CURLOPT_READFUNCTION, read_callback);
curl_easy_setopt(curl, CURLOPT_UPLOAD, 1L);
curl_easy_setopt(curl, CURLOPT_PUT, 1L);
curl_easy_setopt(curl, CURLOPT_URL,
curl_easy_setopt(curl, CURLOPT_READDATA, jpegfilepointer);



By specifying CURLOPT_URL does it just place the file as simple as that
? or do I need to "receive" it?

Thank you so much for your replies.
Received on 2009-02-14