Hi there, I hope you can help. I am getting the following error:

Warning: open_basedir restriction in effect. File is in wrong directory in /home/httpd/vhosts/all4traffic.com/httpdocs/portfolio/freelanceprofile.php on line 22

Warning: getimagesize: Unable to open '/tmp/phpxe60Ds' for reading. in /home/httpd/vhosts/all4traffic.com/httpdocs/portfolio/freelanceprofile.php on line 22

I have safemode off in my php.ini file and I have installed ImageMagick this evening. The code I am using works perfectly on another server but not this one (the code is below). Can somebody tell me why they think it isn't working on this new server? Thanks in advance for your help.

if(is_uploaded_file($logo))
{
$imagearray=getimagesize($logo);
if($imagearray[0]==80 && $imagearray[1]=80)
{
$newname="logo".$MEMBER_ID;
$ext = strtolower(strrchr($logo_name, "."));
$tmp_name=$newname.$ext;
$tmp_path='logos/'.$tmp_name;
$tmp_path = preg_replace( '[\w\d.-_]', '', $tmp_path );
if(move_uploaded_file($logo, $tmp_path))
{
chmod ($tmp_path, 0755);
$result = mysql_query("UPDATE freelancers SET logo='$tmp_name' WHERE id=\"$MEMBER_ID\"",$SESS_DBH);
}
}
else
{
$msg.="<BR>Logo was not uploaded as it's not 80X80.";
}
}

    Hey,

    The open_basedir directive in the php.ini is one of the PHP_INI_SYSTEM variety. If you are in control of the server/your php.ini then you can just unset the open_basedir directive, or change it's value to be less restrictive.

    If your not, then I'd suggest changing the location of where you store your files so you don't run into these errors.

    Take a look at the php manual section on configuration value (namely look at the ini_set() function) this will give you an idea of what you can change to get things working. A little hint would be to change the value of upload_tmp_dir.

    HTH,

      Thank you very much for your help. According to the unix admin it was a problem on their end so it was nothing that I was doing wrong. Thanks anyways!!!

        Write a Reply...