logo       
Google Custom Search
    AddThis Social Bookmark Button

RE: Uploading a file through curl + php: msg#00024

Subject: RE: Uploading a file through curl + php
 
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

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

>Upload how?

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

>> curl_setopt($curl, CURLOPT_POSTFIELDS, substr($str, 0, -1));
>This makes a POST.

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..:

                $curl =
curl_init(_BACKOFFICE_ADDRESS."functions/processreturndata.php");
            $postdata['return_filesize']    = $return_filesize;
            $postdata['return_debug']       = $return_debug;
            $postdata['return_status']      = $return_status;

            $file = fopen($return_filename, "r");

            curl_setopt($curl, CURLOPT_TIMEOUT, 60);
            curl_setopt($curl, CURLOPT_VERBOSE, 1);

            //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);

            curl_exec($curl);

            $succeeded      = (curl_errno($curl) == 0);

- -- Matt

-----BEGIN PGP SIGNATURE-----
Version: PGP 8.1

iQA/AwUBQcal7CtTzPm4J+DXEQJu6QCgkBh98I5HRkma+2TcSUzuDj8vBeoAn1v7
OFijDcduT7aHCPj/e4jhEAiz
=QTBu
-----END PGP SIGNATURE-----





Try Searching:
servers, voip, java, networking, microsoft ...
<Prev in Thread] Current Thread [Next in Thread>