The file extension for JPG images has to be image/pjpeg and this is what you should do:
if(($_FILES['icon']['type'] != 'image/pjpeg') || ($_FILES['icon']['type'] != 'image/gif')) { do something... }
Now, do you have the upload form and the script on the same file or they are separate? 'Cause on my case, if I have them in two different files, the upload form isn't passing the vars to the script, but if they're on the same file, it works great.