אכן צודק...
כל הפעולות אני מפעיל על הזמני עד שאני שומר אותו...
תן לי לנחש שאני אצטרך לתת הרשאות לקובץ הזמני בטח נכון?
אין דרך פשוטה יותר?
הקוד-
PHP קוד:
<?php
if ((($_FILES["uploadfile"]["type"] == "image/gif")
|| ($_FILES["uploadfile"]["type"] == "image/jpeg")
|| ($_FILES["uploadfile"]["type"] == "image/pjpeg")))
{
$uploadedfile = $_FILES['uploadfile']['tmp_name'];
$src = imagecreatefromjpeg($uploadedfile);
list($width,$height)=getimagesize($uploadedfile);
$newwidth=150;
$newheight=($height/$width)*$newwidth;
$tmp=imagecreatetruecolor($newwidth,$newheight);
imagecopyresampled($tmp,$src,0,0,0,0,$newwidth,$newheight,$width,$height);
$ffile = explode(".", $_FILES['uploadfile']['name']);
$ffile[0] = 'b'.$blog['id'];
$efile = $ffile[1];
$ffile = implode(".", $ffile);
$filename = "images/img/". $ffile;
if (file_exists($filename))
{
unlink($filename);
}
chmod("images/img/", 0666);
imagejpeg($tmp,$filename,100);
imagedestroy($src);
imagedestroy($tmp);
?>