我正在建立一个网站,有图片上传。
这是负责图片上传的部分:
$ip=rand();
$filename1 = "/public_html/friendscave/temporary/".$ip;
$filename2 = "/public_html/friendscave/temporary/".rand();
$filename3 = "/public_html/friendscave/temporary/".rand();
$filename4 = "/public_html/friendscave/temporary/".rand();
copy($pictures1, $filename1);
copy($pictures2, $filename2);
copy($pictures3, $filename3);
copy($pictures4, $filename4);
$fp1 = fopen($filename1, 'r');
$contents1 = fread($fp1, filesize($filename1));
$fp2 = fopen($filename2, "r");
$fp3 = fopen($filename3, "r");
$fp4 = fopen($filename4, "r");
$contents2 = fread($fp2, filesize($filename2));
$contents3 = fread($fp3, filesize($filename3));
$contents4 = fread($fp4, filesize($filename4));
fclose($fp1);
fclose($fp2);
fclose($fp3);
fclose($fp4);
$encoded1 = chunk_split(base64_encode($contents1));
$encoded2 = chunk_split(base64_encode($contents2));
$encoded3 = chunk_split(base64_encode($contents3));
$encoded4 = chunk_split(base64_encode($contents4)); 这是我得到的错误
Warning: copy() [function.copy]: open_basedir restriction in effect. File() is not within the allowed path(s): (/home/:/usr/lib/php:/tmp) in /PostAD.php on line 130我不理解这个错误。有人能帮帮我吗?
发布于 2012-09-02 03:17:00
您只能打开/home、/usr/lib/php和/tmp下的文件,但您正在尝试打开/public_html下的文件。
您确定您真的是指根目录中的目录,而不是用户的主目录(/home/someuser/public_html)中的目录吗?
https://stackoverflow.com/questions/12230500
复制相似问题