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

curl-and-php

Re: Uploading a file through curl + php

From: Daniel Stenberg <daniel-curl_at_haxx.se>
Date: Thu, 16 Dec 2004 19:31:11 +0100 (CET)

On Thu, 16 Dec 2004, Matt Parkins wrote:

> I want to use Curl to upload a file to a location on another machine.

Upload how?

> curl_setopt($curl, CURLOPT_POSTFIELDS, substr($str, 0, -1));

This makes a POST.

> curl_setopt($curl, CURLOPT_UPLOAD, 1);

This option is mutually exclusive with POSTing, and implies PUT.

> curl_setopt($curl, CURLOPT_INFILE, $file);
> curl_setopt($curl, CURLOPT_INFILESIZE, $return_filesize);

These two are also for PUTting (if the URL is a http one).

-- 
      Daniel Stenberg -- http://curl.haxx.se -- http://daniel.haxx.se
       Dedicated custom curl help for hire: http://haxx.se/curl.html
Received on 2004-12-16