Hiya.
Can someone please show me how to upload a file to an ftp site using curl/php? I keep getting server errors with this code:
<?
$ch = curl_init ("ftp://uname:password@www.mysite.com/");
$fp = fopen("file.txt","r");
curl_setopt($ch,CURLOPT_PUT,1);
curl_setopt($ch,CURLOPT_INFILE,$fp);
curl_setopt($ch,CURLOPT_INFILESIZE,filesize("file.txt"));
curl_exec ($ch);
curl_close ($ch);
fclose($fp);
?>
If I comment out the middle 3 curl_setopt lines, the directory of www.mysite.com is displayed on my screen, so the curl functions are working.
Furthermore, I'd like to capture the response the server gives me after the upload (i.e. "Upload successful", or whatever).
Any help would be appreciated.
thanks,
Greg