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

curl-and-php

Re: receiving file sent with CURLOPT_PUT

From: Andrey Kuznetsov <kandrey89_at_gmail.com>
Date: Sun, 15 Feb 2009 13:21:30 -0800

You could try using POST command and send a file by indicating a file
stream @ in front of the file name "@C:\file.txt"
There are plenty of examples online, and the POSTFIELDS depends on how
the server prefers to receive what data along with the file data.

On Sun, Feb 15, 2009 at 9:48 AM, Superprops <superprops_at_telus.net> wrote:
> 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
>
_______________________________________________
http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-php
Received on 2009-02-15