Jump to content

image/pjpeg???? Why not just image/jpeg?


phillips321

Recommended Posts

Hi guys.

 

For some reason my friends couldn't upload files to my site. Seemed very odd to me even tho i could upload the same files.

 

I decided to echo the $variables so i could see where there was an error. The image file type was coming back as "image/pjpeg", what is this?

 

Initially i only had image/jpeg, image/gif and image/png, i've now had to add image/pjpeg, seems like IE does this.

 

My code now consists of the following, are there anymore that i need to know about?

if($fail == '0'){
if(@getimagesize($name)){
       		if ($type == 'image/jpeg' || $type == 'image/pjpeg' || $type == 'image/pjpg' || $type == 'image/jpg') {$img = imagecreatefromjpeg($name);}  
        	elseif ($type == 'image/gif') {$img = imagecreatefromgif($name);}
        	elseif ($type == 'image/png') {$img = imagecreatefrompng($name);}
	else {$fail = 'Incorrect file type, please upload either: JPG, GIF or PNG';}
	if(!$img){$fail = 'Incorrect file type, please upload either: JPG, GIF or PNG';}
}
else{$fail = 'Incorrect file type, please upload either: JPG, GIF or PNG';	}
}

Link to comment
https://forums.phpfreaks.com/topic/73085-imagepjpeg-why-not-just-imagejpeg/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.