RE: [PHP] Help w/Bug
Joey mailto:[EMAIL PROTECTED] on Wednesday, March 31, 2004 2:54 PM said: Step1: upload_file_type: Step1: upload_file: C:\\Documents and Settings\\jack.IISG\\Desktop\\BVP.jpg Step1: extention: Step2: upload_file_type: Step2: upload_file: C:\\Documents and Settings\\jack.IISG\\Desktop\\BVP.jpg Step2: extention: image/pjpeg in both cases $upload_file_type is empty. you're comparing $upload_file_type to $file_type1,2,3,4. of course there won't be a match. at least, that's what it looks like to me at a cursory glance. hth, chris. p.s. extention != extension :) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Help w/Bug
* Thus wrote Joey ([EMAIL PROTECTED]): ... 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. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php