cURL / Mailing Lists / curl-and-php / Single Mail

curl-and-php

receiving file sent with CURLOPT_PUT

From: Superprops <superprops_at_telus.net>
Date: Sun, 15 Feb 2009 10:11:26 -0800

Hopefully I've asked this question in the right place as I was informed
the libcurl list was incorrect.

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 (hosted so I don't have any control)?

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

c program snippet: (sending)

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

php snippet: (receiving)

if(isset($_POST['test']))
  $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,
"http://www.somewebsite.com/pictures/uploadedpicture.jpg");
curl_easy_setopt(curl, CURLOPT_READDATA, jpegfilepointer);
curl_easy_setopt(curl,
CURLOPT_INFILESIZE_LARGE,(curl_off_t)file_info.st_size);

php:

???????????????????????????????????

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.
_______________________________________________
http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-php
Received on 2009-02-15