trouble with image upload

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
flann
Forum Commoner
Posts: 38
Joined: Tue Aug 23, 2005 10:48 pm

trouble with image upload

Post by flann »

A few days ago I went through the following tutorial viewtopic.php?t=41743 and it works great. The only problem that I'm having now, is that when using IE and trying to upload a .jpg file, it doesn't work. It works with .gif in IE, and both .gif and .jpg with Firefox, but not .jpg and IE. Does anybody know of any bug out there that I need to fix?
User avatar
JayBird
Admin
Posts: 4524
Joined: Wed Aug 13, 2003 7:02 am
Location: York, UK
Contact:

Post by JayBird »

In what way doesn't it work?
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

onion2k's script looks at the submitted mime-type. IE sends image/pjpeg typically for jpeg files. Looking at the mime-type submission is dangerous as that information is very easily forged. Use getimagesize() instead.
flann
Forum Commoner
Posts: 38
Joined: Tue Aug 23, 2005 10:48 pm

Post by flann »

Code: Select all

Warning: imagegif(): supplied argument is not a valid Image resource in /productInsert.php on line 26

Warning: imagesx(): supplied argument is not a valid Image resource in /productInsert.php on line 32

Warning: imagesy(): supplied argument is not a valid Image resource in /productInsert.php on line 32

Warning: imagesx(): supplied argument is not a valid Image resource in /productInsert.php on line 41

Warning: imagesy(): supplied argument is not a valid Image resource in /productInsert.php on line 42

Warning: imagecreatetruecolor(): Invalid image dimensions in /productInsert.php on line 45

Warning: imagesx(): supplied argument is not a valid Image resource in /productInsert.php on line 46

Warning: imagesy(): supplied argument is not a valid Image resource in /productInsert.php on line 46

Warning: imagecopyresampled(): supplied argument is not a valid Image resource in /productInsert.php on line 46

Warning: imagegif(): supplied argument is not a valid Image resource in /productInsert.php on line 48
once again it works fine in firefox and .gif's work fine in IE, just not .jpg in IE
flann
Forum Commoner
Posts: 38
Joined: Tue Aug 23, 2005 10:48 pm

Post by flann »

why does IE send image/pjpeg as the mime type? I'm just curious
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Why did Microsoft make MS Bob? Both have the same answer: because they could.
Post Reply