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: Mon, 20 Dec 2004 14:03:41 +0100 (CET)

On Mon, 20 Dec 2004, Matt Parkins wrote:

>> Upload how?
>
> Which ever way will work! I'm not too fussy! :@) The upload is a HTTP
> one.

Well, you most likely have a script or program in the receiving end that
already exists and that assume the uploaded data to be using a specific
method. I doubt you can pick any random method on your own.

> I've tried removing this field and it doesn't seem to make a difference -
> the remote HTTP URL is successfully called, but there's nothing in the
> $_FILES variable..:

I have no idea what $_FILES is or what it is supposed to contain. Remember
that I am not a PHP programmer.

Care to elaborate?

Besides, just because you don't get what you expect in the dedicated variables
doesn't mean libcurl didn't do what you asked it to. You just seem to be
asking it to do the wrong thing.

> //POST DOES NOT WORK WITH AN ATTEMP TO UPLOAD BELOW
> curl_setopt($curl, CURLOPT_PUT, 1);
> curl_setopt($curl, CURLOPT_INFILE, $file);
> curl_setopt($curl, CURLOPT_INFILESIZE, $return_filesize);

So, does the PUT fail or isn't it your server that doesn't expect/want a PUT?

I would recommend you read this before you continue:

         http://curl.haxx.se/docs/httpscripting.html

... and as usual: I recommend working out the details with the command line
tool and when everything works you convert it over to curl-functions in your
PHP program.

-- 
      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-20