Please Help Me!!
I am running an image upload script on a new server that has the user default set as "nobody" and its causing a permissions error.
Here is the error:
Warning: copy(upload/fullsize/7b6df389_5.jpg): failed to open stream: Permission denied in /home/subcultu/public_html/include/gallery.inc.php on line 111
Warning: imagejpeg(): Unable to open 'upload/thumbs/7b6df389_5.jpg' for writing in /home/subcultu/public_html/include/gallery.inc.php on line 118
Photo 5 uploaded successfully
Here is the code:
<?
}
else
{
if (($file1_name=="") && ($file2_name=="") && ($file3_name=="") && ($file4_name=="") && ($file5_name==""))
{
echo "<p class=textbold>No files were selected for uploading</p><br>";
}
else
{
$r=mysql_query("select filename from hangout_gallery where userid=$_SESSION[userid]");
$f=mysql_fetch_array($r);
$fn=$f[filename];
$fil[1]=$file1; $fil_name[1]=$file1_name; $fil_size[1]=$file1_size;
$fil[2]=$file2; $fil_name[2]=$file2_name; $fil_size[2]=$file2_size;
$fil[3]=$file3; $fil_name[3]=$file3_name; $fil_size[3]=$file3_size;
$fil[4]=$file4; $fil_name[4]=$file4_name; $fil_size[4]=$file4_size;
$fil[5]=$file5; $fil_name[5]=$file5_name; $fil_size[5]=$file5_size;
for ($i=1;$i<=5;$i++)
{
if ($fil_name[$i]!="")
{
$ext = strrchr($fil_name[$i],'.');
$ext = strtolower($ext);
if ($ext==".jpeg") $ext=".jpg";
if ($ext!=".jpg") { echo "<p class=textbold>Photo $i upload error : Only JPEG format supported</p><br>"; }
else
{
if ($fil_size[$i]>353600)
{
echo "<p class=textbold>Photo $i upload error : Size is more than 350k limit</p><br>";
}
else
{
$sz=getimagesize($fil[$i]);
if ($sz[0]>400)
{
$img=imagecreatefromjpeg($fil[$i]);
$sx=imagesx($img);
$sy=imagesy($img);
$dx=400;
$dy=$sy/($sx/400);
$img1=imagecreatetruecolor($dx,$dy);
imagecopyresampled($img1,$img,0,0,0,0,$dx,$dy,$sx,$sy);
imagejpeg($img1,"upload/fullsize/".$fn."_$i.jpg");
imagedestroy($img);
imagedestroy($img1);
}
else
{
copy($fil[$i],"upload/fullsize/".$fn."_$i.jpg");
};
$img=imagecreatefromjpeg("upload/fullsize/".$fn."_$i.jpg");
$sx=imagesx($img);
$sy=imagesy($img);
$img1=imagecreatetruecolor(68,70);
imagecopyresampled($img1,$img,0,0,0,0,68,70,$sx,$sy);
imagejpeg($img1,"upload/thumbs/".$fn."_$i.jpg");
imagedestroy($img);
imagedestroy($img1);
echo "<p class=textbold>Photo $i uploaded successfully</p><br>";
};
};
};
};
};
};
?>
My programmer can't fix and my host can't fix.
I need help!!
Thanks!