Page 1 of 1

Uploading jpg works in IE but not FF

Posted: Mon Nov 20, 2006 2:31 pm
by speedmonk
Hello, I have a script that works when you use IE, but when you use FF.

It just uploads a jpg and saves it in a gallery.

I check to see if it is a JPG. If the file is uploaded with FF, I can't get past this part. :(

Code: Select all

if ($_FILES['upload']['type'] == "image/pjpeg")
					{ 
							
						copy ($_FILES['upload']['tmp_name'], "images/uploads/".$_FILES['upload']['name']) 
   						or die ("Could not copy, was it something evil?");
:cry:

Any thoughts?

Thanks!
JM

Posted: Mon Nov 20, 2006 3:21 pm
by feyd
Firefox doesn't use pjpeg.

At any rate it's dangerous to even look at the type provided by the browser. Why? Anyone with malicious intent can easily fake that information. Use getimagesize().

Posted: Mon Nov 20, 2006 3:30 pm
by speedmonk
Ahhh! Cool.

I misunderstood what was happening.

I thought the mime type was based on my server, and that information was provided by PHP 'looking' at the file that was uploaded.

getimagesize() will actually look at what was uploaded I guess.

Thank you very much!!!!