hello ppl..
i am facing problem in uploading pic in pro. i cant figure out the problem.i seen code but i cant find it.
error is imagejpeg() [function.imagejpeg]: Unable to open './avatars/2u.jpg' for writing: Permission denied in /home/mysite/public_html/mysite/genproc.php on line 2287
i tried to put chmod to 777 though it dont worked. it says permission denied so i tried to put chmod to 777 so wats wrong in this code?
i am facing problem in uploading pic in pro. i cant figure out the problem.i seen code but i cant find it.
error is imagejpeg() [function.imagejpeg]: Unable to open './avatars/2u.jpg' for writing: Permission denied in /home/mysite/public_html/mysite/genproc.php on line 2287
i tried to put chmod to 777 though it dont worked. it says permission denied so i tried to put chmod to 777 so wats wrong in this code?
PHP Code:
else if($action=="upavat"){
addonline(getuid_sid($sid),"Uploading Avatar Image","");
echo "<head>";
echo "<title>Uploading Avatar Image</title>";
echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
echo "</head>";
echo "<body>";
$size = $_FILES['attach']['size']/1024;
$origname = $_FILES['attach']['name'];
$res = false;
$ext = explode(".", strrev($origname));
switch(strtolower($ext[0])){
case "gpj":
$res = true;
break;
case "gepj":
$res = true;
break;
}
$tm = time();
$uploaddir = "./avatars";
if($size>512){
echo "File is larger than 512KB";
}
else if ($res!=true){
echo "File type not supported! Please attach only a JPG/JPEG.";
}
else{
$name = getuid_sid($sid);
$uploadfile = $name.".".$ext;
$uppath=$uploaddir."/".$uploadfile;
move_uploaded_file($_FILES['attach']['tmp_name'], $uppath);
$filewa=$uppath;
list($width, $height, $type, $attr) = getimagesize($filewa);
$newname=$uploaddir."/".$name."u.jpg";
$newheight = ($height*128)/$width;
$newimg=imagecreatetruecolor(128, $newheight);
$largeimg=imagecreatefromjpeg($filewa);
imagecopyresampled($newimg, $largeimg, 0, 0, 0, 0, 128, $newheight, $width, $height);
imagejpeg($newimg, $newname);
imagedestroy($newimg);
imagedestroy($largeimg);
$file1=$name."u.jpg";
unlink($filewa);
$res1 = mysql_query("UPDATE ibwf_users SET avatar='./avatars/$file1' WHERE id='".$name."'");
}
if($res1){
echo "Your file $origname was successfully uploaded and set to your profile!";
}
else {
echo "File couldn't be processed! Check error messages and report to a moderator or admin if applicable.";
}
echo "<br/><br/><b>0 </b><a accesskey=\"0\" href=\"index.php?action=main\"><img src=\"../images/home.gif\" alt=\"\"/>Home</a>";
echo "</p>";
echo "</body>";
}
Comment