Uploading jpg works in IE but not FF

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
speedmonk
Forum Newbie
Posts: 13
Joined: Thu Apr 06, 2006 10:54 am

Uploading jpg works in IE but not FF

Post 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
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post 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().
speedmonk
Forum Newbie
Posts: 13
Joined: Thu Apr 06, 2006 10:54 am

Post 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!!!!
Post Reply