开发者

php trying to save image from the web, error

I can't get this script to save an image to a folder... The error is:

Warning: fopen(/var/www/tmp/image2.png): failed to open s开发者_开发问答tream: Permission denied in /var/www/testqr.php on line 15 
Warning: fwrite() expects parameter 1 to be resource, boolean given in /var/www/testqr.php on line 16 
Warning: fclose() expects parameter 1 to be resource, boolean given in /var/www/testqr.php on line 17


<?php
$fl = $_SERVER['DOCUMENT_ROOT'].'/tmp/image2.png';
$file = fopen($fl, "w");
$url = "http://chart.apis.google.com/chart?chs=150x150&cht=qr&chld=L|0&chl=http://superiorwebsys.com'";
$curl = curl_init($url);

curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_FILE, $file);

curl_exec($curl);
curl_close($curl);
fclose($file);
?>

do this:

chown -R your_username /your/directory/
chmod -R 777 /your/directory/
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜