Jump to content

Upload script problem with IE?


johnharris

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.
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.