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

curl-and-php

Re: receiving file sent with CURLOPT_PUT

From: Stephen Pynenburg <spynenburg_at_gmail.com>
Date: Sun, 15 Feb 2009 13:42:17 -0500

It mostly depends on whether your server allows PUT requests - I would
imagine that many don't. This page [
http://www.nusphere.com/kb/phpmanual/features.file-upload.put-method.htm]
gives a good-looking script, but I'm not sure what you have to modify in
Apache to make it work properly. (or .htaccess).
Is there any reason why you need to use PUT instead of POST?
-Stephen

On Sun, Feb 15, 2009 at 1:11 PM, 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