phillips321 Posted October 13, 2007 Share Posted October 13, 2007 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'; } } Quote Link to comment https://forums.phpfreaks.com/topic/73085-imagepjpeg-why-not-just-imagejpeg/ Share on other sites More sharing options...
derwert Posted October 21, 2007 Share Posted October 21, 2007 The filetype is set by the browser, so you may want to download different browsers and upload images to see if any other browsers set the filetype differently. Quote Link to comment https://forums.phpfreaks.com/topic/73085-imagepjpeg-why-not-just-imagejpeg/#findComment-374628 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.