Strange IE / PHP problem...

BeauJangles

Lifer
Aug 26, 2001
13,941
1
0
Hey guys,

I was testing out the final version of my site before it goes live and noticed that when I try to upload images with IE it fails. The code works perfectly in Firefox, however. The processing code is attached... and in IE it always returns the error "Sorry, we only accept .jpg images under 120kb for upload" even if the image is smaller than 120kb. Any thoughts or suggestions?
 

Zugzwang152

Lifer
Oct 30, 2001
12,134
1
0
there are 2 different MIME types for jpegs, for some reason. image/jpeg and image/pjpeg, google to find the difference.
 

stndn

Golden Member
Mar 10, 2001
1,886
0
0
It's because in MSIE, instead of setting:
$_FILES['portrait']['type'] == 'image/jpeg'

It sets the type to:
image/pjpeg

So your if() statement fails.

I think it is better to call @getimagesize($_FILES['portrait']['tmp_name']) and then check the type (third argument) to see if it's a JPG image or not.
 

DannyBoy

Diamond Member
Nov 27, 2002
8,820
2
81
www.danj.me
Originally posted by: stndn
It's because in MSIE, instead of setting:
$_FILES['portrait']['type'] == 'image/jpeg'

It sets the type to:
image/pjpeg

So your if() statement fails.

I think it is better to call @getimagesize($_FILES['portrait']['tmp_name']) and then check the type (third argument) to see if it's a JPG image or not.

yup yup :)