开发者

php trying to save image from the web, error

开发者 https://www.devze.com 2023-04-11 19:47 出处:网络
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

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

精彩评论

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