I released a script recently, in which people could upload an image along with other information. It worked fine for me and my beta-testers, but some people are reporting problems when they try to upload an image:
/tmp/php5tCspj
Warning: open_basedir restriction in effect. File is in wrong directory in /home/sites/site198/web/modules/Encyclopedia/pnuserapi.php on line 581
Warning: getimagesize: Unable to open '/tmp/php5tCspj' for reading. in /home/sites/site198/web/modules/Encyclopedia/pnuserapi.php on line 581
Here's the code in question ($file is the file that is uploaded through the form, and $imagewidth and $imageheight are defined elsewhere. ):
$imgsize = GetImageSize($file);
if (($imgsize[0] > $imagewidth) || ($imgsize[1] > $imageheight))
{
unlink($file);
return false;
}
else if (($imgsize[2] != 1) && ($imgsize[2] != 2))
{
unlink($file);
return false;
}
else
{
if ($imgsize[2] == 1)
$ext = ".gif";
if ($imgsize[2] == 2)
$ext = ".jpg";
// Store image on filesystem
$outfile = "modules/Encyclopedia/pictures/" . $id . $ext;
There's more stuff here that isn't really relevant to my question...
}
The script is choking for these people on line 581, which is the part that says $imgsize = GetImageSize($file);
The person in question swears that safe mode is turned off on his server. So I dunno. Any other ideas why this is happening? And how to fix it?