Jump to content

Archived

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

johnharris

Upload script problem with IE?

Recommended Posts

I have an upload script written in php for uploading images etc. It works fine in firefox, however not in IE....

[code]

if (isset($_FILES['uploadedphoto'])) {

$targetpath = "images/photos/profiles";

if (($_FILES["uploadedphoto"]["type"] == "image/gif") || ($_FILES["uploadedphoto"]["type"] == "image/jpeg") && ($_FILES["uploadedphoto"]["size"] < 700000)) {

if ($_FILES["uploadedphoto"]["error"] > 0) {

    echo "Return Code: " . $_FILES["uploadedphoto"]["error"] . ". Profile photo was not uploaded.<br />";
   
} else {

    if (file_exists($targetpath . "/" . $_FILES["uploadedphoto"]["name"])) {
     
  echo $_FILES["uploadedphoto"]["name"] . " already exists. Profile photo was no uploaded";
     
} else {
     
 
  if (move_uploaded_file($_FILES["uploadedphoto"]["tmp_name"], $targetpath . "/" . $_FILES["uploadedphoto"]["name"])) {

$completeurl = $targetpath . "/" . $_FILES["uploadedphoto"]["name"];
$query = "UPDATE users SET pic_url='$completeurl' WHERE username='$u'";
$result = @mysql_query($query);

if (!$result) {

echo 'Profile photo was not uploaded.';

}

} else {

echo 'Profile photo was not uploaded.';

}
     
}

    }

} else {
 
echo "Invalid profile photo - file size too big (must be under 700kb) / wrong file type (must be jpeg or gif)";
 
}

}

[/code]

As i said, in firefox it works fine, in IE the "else" statement of the ...

"if (($_FILES["uploadedphoto"]["type"] == "image/gif") || ($_FILES["uploadedphoto"]["type"] == "image/jpeg") && ($_FILES["uploadedphoto"]["size"] < 700000)) {"

... is called.

Share this post


Link to post
Share on other sites

×

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.