Re: Help w/Bug

From: Date: Thu, 01 Apr 2004 04:56:54 +0000
Subject: Re: Help w/Bug
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-181993@lists.php.net to get a copy of this message
* Thus wrote Joey (Joey@Web56.Net): > ... > > if($upload_file !="") > { > //image size esle will ignore ... > $img_max_width=750; > $img_max_height=750; > $extention= > $file_type1 = "image/pjpeg"; Here is your bug as you described. $extention is assigned the value of $file_type1 after it is assigned 'image/pjpeg'. > ... > > if (($upload_file_type == $file_type1) or ($upload_file_type == $file_type2) > or ($upload_file_type == $file_type3) or ($upload_file_type == $file_type4)) > { There are several more elegant solutions to testing to ensure that the file_type is good, one of them is: $accept_file_types = array('image/jpeg', 'image/gif'); if (in_array($upload_file_type, $accept_file_types) ) { > ... > > $image_url="images/contacts/".$upload_file_name; > > @copy($upload_file, "images/contacts/".$upload_file_name); see http://php.net/move_uploaded_file about the proper way to handle uploaded files. > chmod("images/contacts/".$upload_file_name,0777); 0644 should be used. 777 is evil, contrary to common belief. Curt -- "I used to think I was indecisive, but now I'm not so sure."

« previous php.general (#181993) next »