Jump to content

Image upload problem in IE but not FF


JJBlaha

Recommended Posts

This script works perfectly in Firefox, but outputs

Could Not Copy, Wrong Filetype (imagename)

in Internet Explorer

[code]
if(!empty($imagefile)) {
if ($_FILES['imagefile']['type'] == "image/gif" || $_FILES['imagefile']['type'] == "image/jpg" || $_FILES['imagefile']['type'] == "image/jpeg" ){

copy ($_FILES['imagefile']['tmp_name'], "images/userimages/".$_FILES['imagefile']['name'])
or die ("Could not copy");
     
echo "";
echo "Name: ".$_FILES['imagefile']['name']."";
echo "Size: ".$_FILES['imagefile']['size']."";
echo "Type: ".$_FILES['imagefile']['type']."";
echo "Copy Done....";
} else {
echo "";
echo "Could Not Copy, Wrong Filetype (".$_FILES['imagefile']['name'].")";
}
}
[/code]

Any idea why?
Link to comment
https://forums.phpfreaks.com/topic/29582-image-upload-problem-in-ie-but-not-ff/
Share on other sites

[quote author=Destruction link=topic=117485.msg479333#msg479333 date=1165356585]
IE can set image/jpeg as image/pjpeg so you'll need to add that to the allowed list.  This is noted in the php.net manual documentation.

Hope this helps,

Dest
[/quote]

worked perfectly thanks :)

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.