Firefox and file uploads

I'm using the following code to try to upload images via firefox.

<?
//The data encoding type, enctype, MUST be specified as below

echo "<form enctype=\"multipart/form-data\" action=\"sendfile.php\" method=\"POST\"
>";

//MAX_FILE_SIZE must precede the file input field -->";
echo "<input type=\"hidden\" name=\"MAX_FILE_SIZE\" value=\"1048576\" />";

//Name of input element determines name in $_FILES array
echo "Send this file: <input name=\"userfile\" type=\"file\" />";
echo "<input type=\"submit\" value=\"Send File\" />";
echo "</form>";
?>

then in sendfile.php I have...

<?php

$uploaddir = '/home/web/site/uploads/';
$uploadfile = $uploaddir . basename($_FILES['userfile']['name']);

echo '<pre>';
echo $uploadfile . "<br>";
if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)) {
   echo "File is valid, and was successfully uploaded.\n";
} else {
   echo "Possible file upload attack!\n";
}

echo 'Here is some more debugging info:';
print_r($_FILES);

print "</pre>";

?>

It works fine in internet explorer but it fails in firefox.  In firefox the output of the debugging info looks like this.

/home/web/site/uploads/correctimage.jpg
Possible file upload attack!
Here is some more debugging info:Array
(
    [userfile] => Array
        (
            [name] => correctimage.jpg
            [type] =>
            [tmp_name] =>
            [error] => 2
            [size] => 0
        )

)

How can I lookup what the error means and what is the problem?
serjoshAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Muhammad WasifCommented:
This is PHP code and run on server not on the client side. I tested this code in Firefox and its working fine with me.

Look at the debug info, if the file had uploaded it must have some value in tmp_name. Its mean file is not uploaded.

(
    [userfile] => Array
        (
            [name] => correctimage.jpg
            [type] =>
            [tmp_name] =>
            [error] => 2
            [size] => 0
        )

)

Are you using the same file to upload in both browsers?
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
serjoshAuthor Commented:
it is the exact same file and I've tried many different files, all relatively small, IE always works and firefox doesnt.    

DOH!  I just figgured it out.  For some odd reason all I had to do was restart firefox and it then worked *shrug*
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
PHP

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.