You can stat (get filesize, modification time, permissions) only local files - download it first and then get its filesize if you need it.

Steve Keller wrote:

I'm still trying to get a file posted to another server, but I seem to have run across an odd snag, and I was hoping someone can point out where I've gone wrong. Here's the code:

$data = "mtype=XMLDOC&outfile=true";
$dataFile = "";;
$fileSize = filesize($dataFile);
$fp = fopen($dataFile, "rb");
$strFile = fread($fp, $fileSize);


$ch = curl_init();
$res = curl_setopt($ch, CURLOPT_POST, 1);
echo "Set Post: ".$res;
$res = curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
echo "<br />Set Follow: ".$res;
$res = curl_setopt($ch, CURLOPT_VERBOSE, 1);
echo "<br />Set Verbose: ".$res;
$res = curl_setopt($ch, CURLOPT_URL, $osbURL);
echo "<br />Set URL: ".$res;
$res = curl_setopt($ch, CURLOPT_POSTFIELDS, $data."&mediafile=".$strFile);
echo "<br />Set Postfields: ".$res;
$res = curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
echo "<br />Set ReturnTransfer: ".$res;

$result = curl_exec($ch);
echo $result;

What I'm getting is

Warning: stat failed for (errno=2 - No such file or directory) in /usr/local/www/vhosts/ on line 20

I'm positive the file exists, and if I cut and paste the URL from the error to a browser window, I can see the file. What am I doing wrong?
S. Keller
UI Engineer
The Health TV Channel, Inc.
(a non - profit organization)
3820 Lake Otis Pkwy.
Anchorage, AK 99508
907.770.6200 ext.220
907.336.6205 (fax)

PHP General Mailing List (
To unsubscribe, visit:

Reply via email to