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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.