php - PNG files won't upload -
i have following script use upload pictures; file works every other file extension except png files. there reason?
this script;
// initialization $result_final = ""; $counter = 0; // list of our known photo types $known_photo_types = array( 'image/pjpeg' => 'jpg', 'image/jpeg' => 'jpg', 'image/gif' => 'gif', 'image/bmp' => 'bmp', 'image/x-png' => 'png'); // gd function suffix list $gd_function_suffix = array( 'image/pjpeg' => 'jpeg', 'image/jpeg' => 'jpeg', 'image/gif' => 'gif', 'image/bmp' => 'wbmp', 'image/x-png' => 'png'); // fetch photo array sent preupload.php $photos_uploaded = $_files['photo_filename']; // fetch photo caption array $photo_caption = $_post['photo_caption']; while( $counter <= count($_files['photo_filename']['tmp_name']) ) { if($photos_uploaded['size'][$counter] > 0) { if(!array_key_exists($photos_uploaded['type'][$counter], $known_photo_types)) { $result_final .= "file ".($counter+1)." not photo!<br />"; }else{ mysql_query( "insert database(`filename`, `caption`, `category`, `id`) values('0', '".addslashes($caption[$counter])."', '".addslashes($_post['category'])."', '".addslashes($_post['id'])."')" ); $new_id = mysql_insert_id(); $filetype = $photos_uploaded['type'][$counter]; $extention = $known_photo_types[$filetype]; $filename = $new_id.".".$extention; @mysql_query( "update database set photo_filename='".addslashes($filename)."' photo_id='".addslashes($new_id)."'" ); // store orignal file copy($photos_uploaded['tmp_name'][$counter], $images_dir2."/".$filename); } } $counter++; }
thats code , works fine when upload jpeg or gif file when upload png file, doesn't work. don't no error neither. please, error?
merely change to:
image/png