If(isset) with $_FILES not working correctly
Posted: Sat Jun 16, 2007 8:59 am
hi Guys,
I have this
but for some reason when I do not upload a new logo the code in the if part that is not meant to be executed is.
any ideas why?
on my form I have 1 hidden field call original_logo and another file field called logo
Thanks in advance.
thanks
I have this
Code: Select all
if(isset($_FILES['logo']['tmp_name'])){
$uploadedfile = $_FILES['logo']['tmp_name'];
$src = imagecreatefromjpeg($uploadedfile);
list($width,$height)=getimagesize($uploadedfile);
move_uploaded_file($uploadedfile, "../logos/". strtolower(str_replace(" ", "-", $company_name. ' ' . $company_site.'_original.jpg')));
$newwidth=30;
$newheight=($height/$width)*30;
$tmp=imagecreatetruecolor($newwidth,$newheight);
imagecopyresampled($tmp,$src,0,0,0,0,$newwidth,$newheight,$width,$height);
$filename = "../logos/". strtolower(str_replace(" ", "-", $company_name. ' ' . $company_site.'.jpg'));
$logo = strtolower(str_replace(" ", "-", $company_name. ' ' . $company_site.'.jpg'));
imagejpeg($tmp,$filename,100);
imagedestroy($src);
imagedestroy($tmp);
} else {
$logo = $_POST['original_logo'];
};
any ideas why?
on my form I have 1 hidden field call original_logo and another file field called logo
Thanks in advance.
thanks