Reputation: 2140
I am building a website that has image uploading.
This is the part that is responsible of image uploading:
$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));
This is the error that I got
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
I didn't understand this error. Can someone help me please?
Upvotes: 0
Views: 1705
Reputation: 11292
You are only allowed to open files that are under /home
, /usr/lib/php
and /tmp
, but you are trying to open a file under /public_html
.
Are you sure you really meant a directory immediately in the root directory, and not in the user's home directory (/home/someuser/public_html
)?
Upvotes: 3