As you've discovered, relying on the client to send you the correct MIME type for the file it's uploading is pretty unreliable (you've looked to see what it is using?). You can use [man]getimagesize/man to tell you what type of image file it really is.
Incidentally, && has a higher precedence than ||, so your first test is equivalent to
if(/*image is GIF*/ || (/* image is JPEG */ && /* image is not too big */ ))
So it allows really really big GIFs.
And doesn't allow PNGs for some reason....