alphasurf Posted November 30, 2006 Share Posted November 30, 2006 Ok here is my script I am having problems getting it to work. It just will upload any size or file type, it is like it skips right over the getimagesize ....[code]<?require_once("conn.php");if(isset($_POST[s1])){$acceptedImages = array('IMG_GIF', 'IMG_JPG', 'IMG_PNG');foreach($_FILES['images']['tmp_name'] as $tmpImageName) { if (file_exists($tmpImageName)) { $imgSize = getimagesize($tmpImageName); if($imgSize === false) { //not an image $error = "<b>Your banner must be an image</b>"; } else if ($imgSize[0] <= 640 || $imgSize[1] <= 640) { $error = "<b>For best results your image should be either 640 wide by 480 high<br> or 480 wide by 640 high, no larger!</b>"; } else if (!in_array($imgSize[2], $acceptedImages)) { $error = "<b>You can upload only .gif .jpg and .png image files!</b>"; } }}//Change end---> if(!empty($_FILES['images']['name'][0])) { while(list($key,$value) = each($_FILES['images']['name'])) { if(!empty($value)) { $NewImageName = $t."_offer_".$value; copy($_FILES['images']['tmp_name'][$key], "re_images/".$NewImageName); $MyImages[] = $NewImageName; } } if(!empty($MyImages)) { $ImageStr = implode("|", $MyImages); } } $catInfo = explode("|", $_POST[SelectCategory]); $CategoryID = $catInfo[0]; $SubcategoryID = $catInfo[1]; $SubcategoryName = $catInfo[2]; $q1 = "INSERT INTO d_s_listings set AgentID = '$_SESSION[AgentID]', CategoryID = '$CategoryID', SubcategoryID = '$SubcategoryID', SubcategoryName = '$SubcategoryName', Weight = '$_POST[Weight]', city = '$_POST[city]', state = '$_POST[state]', oneliner = '$_POST[oneliner]', greeting = '$_POST[greeting]', description1 = '$_POST[description1]', Price = '$_POST[Price]', incall = '$_POST[incall]', description2 = '$_POST[description2]', Height = '$_POST[Height]', BodyType = '$_POST[BodyType]', Liner = '$_POST[Liner]', HairColor = '$_POST[HairColor]', EyeColor = '$_POST[EyeColor]', Ethnicity = '$_POST[Ethnicity]', UserAge = '$_POST[UserAge]', AttentionColor = '$_POST[AttentionColor]', DetailsColor = '$_POST[DetailsColor]', Preference = '$_POST[Preference]', Site = '$_POST[Site]', Website = '$_POST[Website]', Visit = '$_POST[Visit]', FromMonth = '$_POST[FromMonth]', FromDay = '$_POST[FromDay]', ToMonth = '$_POST[ToMonth]', ToDay = '$_POST[ToDay]', image = '$ImageStr', DateAdded = '$t' "; mysql_query($q1); if(mysql_error()) { echo mysql_error(); } else { header("location:manage.php"); }}?>[/code] Link to comment https://forums.phpfreaks.com/topic/28962-getimagesize-need-help-please/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.