"Undefined index" when trying uploading file using PHP
<p>This is suppose to be pretty straight forward and is driving me mad!</p>

<p>I'm trying to upload a file in PHP and writing the file to MySQL as a blob.</p>

<p>Problem is that the site throws a "Undefined index" all the time when I'm trying to use the</p>

<p>$_FILES['file']['tmp_name'] property.</p>

<p>Here is my code : </p>

<pre><code>&lt;head&gt;
    &lt;title&gt;Upload Worksheet&lt;/title&gt;
&lt;/head&gt;
&lt;body&gt;
    &lt;form action="index.php" method="POST" enctype="multipart/form-data"&gt;
        &lt;input type="hidden" name="MAX_FILE_SIZE" value="2000" /&gt;
        File : 
        &lt;input type="file" name"file" id="file"&gt;&lt;input type="submit" value="Upload"&gt;
    &lt;/form&gt;


    &lt;?php

        //connect to db
        mysql_connect("localhost","root","") or die(mysql_error());
        mysql_select_db("autoedi") or die(mysql_error());

        //file properties
        $file = $_FILES['file']['tmp_name'];

        if(!isset($file))
        echo "Please choose a file.";
        else {
            $uploadfile = addslashes(file_get_contents( $_FILES['file']['name']));
            $uploadfilename = addslashes($_FILES['file']['tmp_name']);  
        }


    ?&gt;


&lt;/body&gt;
</code></pre>

<p>This is what the error message looks like :</p>

<p><img src="http://i.stack.imgur.com/M4xPB.jpg" alt="Error Message"></p>

<p>I haven't even gotten to the database side, as I can't get past this stage.</p>

<p>I'm a PHP noob, so any help would be greatly appreciated!</p>
