Can someone tell me wy image/png dos not workinig in IE

Her i have the code

<?php
session_start();
if(!session_is_registered(myusername))
	{
	header("location:../../../weinachtfeier.php");
	}
	
?>
   <body bgcolor="blue">
<?php
		if (isset($_POST['senden']))
		{
			
		if($_FILES['cover']['size'] === 0 || empty($_FILES['cover']['tmp_name']) || $_FILES['pic']['size'] === 0 || empty($_FILES['pic']['tmp_name']))
		{
		echo("<form action='albums.php'
		<div  style='background-color: blue; border: solid red 3px; width:52%;'><br>cover Sie haben kein Foto und/oder cover gewählt <br>für das album Weinachtfeier.<br>Klicken Sie auf OK, um zurückzukehren.<br><br><input type='submit' value='OK' ><br>&nbsp;</div></form>
		");
		} else if($_FILES['cover']['size'] > 500000) {
    echo("<p>The file was too large.</p>\r\n");
							} 
							else if($_FILES['cover']['error'] !== UPLOAD_ERR_OK) {
						// There was a PHP error
						echo("<p>Es war ein fehler mit hochladen,<br> probieren sie nochnal.<br>Oder nimm conact auf mit dem webmaster</p>\r\n");
					} else {
require('config.php');
$weinachtfeier = $_POST['aname'];
$mapbeschrijving = $_POST ['expl'];
$slides="slides";
$thumbs="thumbs";
if ($mapbeschrijving == ""){
echo "geen beschrijving";
die;
}
else


 
	  $new_height1=100;
	  $new_width1=66;
		
		$new_height=66;
		$new_width=100;
		
     $allowed_types = array( 
     'image/pjpeg', 
     'image/jpg',
     'image/png', 
     'image/jpeg'); 
	
$imagesize = $_FILES['cover']['size'];
		$imagetype = $_FILES['cover']['type'];
       $imagefile=$_FILES['cover']['name'];
	   	 
	 
     if(in_array($_FILES['cover']['type'], $allowed_types)) 
     {	 
       copy ($_FILES['cover']['tmp_name'], $_FILES['cover']['name']) or die     ("Could not copy");
		 $imagesize = $_FILES['cover']['size'];
		$imagetype = $_FILES['cover']['type'];
       $imagefile=$_FILES['cover']['name'];
	   
       list($width, $height) = getimagesize($_FILES['cover']['name']);
			
		 
			if ($_FILES['cover']['type'] == "image/png" )
			{ 
			if ($width<=$height){
				
				$image_p1 = imagecreatetruecolor($new_width1,$new_height1);
				$img = imagecreatefrompng($imagefile);
				


				imagecopyresampled($image_p1, $img, 0, 0, 0, 0, $new_width1, $new_height1, $width, $height);
				$thename=$_FILES['cover']['name'];
				$thenames="thumb$thename";
				if (file_exists($mapbeschrijving)) {
					
					echo"
		 <form action=albums.php>
		 <table width='400px' height='200px' bgcolor='yellow'>
		 <tr>
		 <td align='center' style='color:red;' >
		 Das Album mit dem Namen $mapbeschrijving existiert bereits.<br>Bitte geben Sie eine andere Beschreibung.<br><br>
		 *Wenn Sie fertig sind auf abmelden klikken.&nbsp;&nbsp;<b><a href='logout.php'>Abmelden</a></b>
		 </td>
		 </tr>
		 <tr>
		 <td align='center'><br>
		 <input type='submit'value='zurück. '><br><br>
		 </td>
		 
		 </tr>
		 
		 </table>
		  ";		
    
} else {						
						if (isset($_POST ['expl'])) {
							
						if(mkdir("$mapbeschrijving", 0777)){ if (mkdir("$mapbeschrijving/$slides", 0777)){ if (mkdir("$mapbeschrijving/$thumbs", 0777)){
						include "album_angemacht.php";
							} }}
							else {
						echo "Er is iets niet goed gegaan.";
								}
						$location1="$mapbeschrijving/$slides/$thename";
						$location="$mapbeschrijving/$thumbs/$thenames";
						imagepng($image_p1,$location, 9);
						imagepng($img,$location1, 9);
						unlink($thename);
											
						include "iffileexist.php";			
						}
									}
				}

if it is not an image/png i put a warning at the end
as follow

}
		 else{ 
		 echo"
		 <form action=albums.php>
		 <table width='400px' height='200px' bgcolor='yellow'>
		 <tr>
		 <td align='center' style='color:red;' >
		 Es sind nur<br>.jpeg, .jpg und .png foto's elaubt<br>
		 Klikken sie auf zurück um zurück zu gehen.<br><br>
		 Wenden sie sich an den webmaster<br> wenn sie doch .gif fotos hochladen wollen.<br><br>
		 *Wenn Sie fertig sind auf abmelden klikken.&nbsp;&nbsp;<b><a href='logout.php'>Abmelden</a></b>
		  </td>
		 </tr>
		 <tr>
		 <td align='center'><br>
		 <input type='submit'value='zurück. '><br><br>
		 </td>
		  </tr>
		  </table>
		  ";
		  		}  
		  }}

So i have always this warning only for image/png.
'image/pjpeg',
'image/jpg',
'image/jpeg'); is working correct.

I do not know what's wrong because in FF ,Chrome, Safari it works perfect

thanks in advice John

Recommended Answers

All 3 Replies

try to print_r it on ie it will return diferrent than image/png

As far as I am aware, now this could be wrong.
Internet Explorer sends, image/x-png.

Just a little bit of advice, checking valid types from $_FILES isn't the best idea, getImageSize() may be the better alternative.

-MrDJK

Thank you for the help
It's working

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.