is_uploaded_file error
<p>i have this error in my upload file. The syntax is correct, where is the problem? </p>

<p>The error:</p>

<pre><code>is_uploaded_file() expects parameter 1 to be string, array given in C:\Program Files\EasyPHP-5.3.5.0\www\bena_website\admin\variables\upload_img.php on line 34
</code></pre>

<h3>Please Choose a File and click Submit</h3>

<pre><code>    &lt;form enctype="multipart/form-data" action="&lt;?php echo $_SERVER['PHP_SELF']; ?&gt;" method="post"&gt;
        &lt;input type="hidden" name="MAX_FILE_SIZE" value="10000000" /&gt;
        &lt;input name="userfile[]" type="file" /&gt;
        &lt;input type="submit" value="Submit" /&gt;
    &lt;/form&gt;
</code></pre>

<p>Please select a file</p>';
            }
            else
                {
                print_r( $_FILES );
                try {
                    upload();
                    // give praise and thanks to the php gods
                    echo '<p>Thank you for submitting</p>';
                }
                catch(Exception $e) {
                    echo $e->getMessage();
                    echo 'Sorry, could not upload file';
                }
            }
    // the upload function
    function upload(){</p>

<pre><code>if(is_uploaded_file($_FILES['userfile']['tmp_name'])) {

    // check the file is less than the maximum file size
    if($_FILES['userfile']['size'] &lt; $maxsize)
        {
    // prepare the image for insertion
    $imgData =addslashes (file_get_contents($_FILES['userfile']['tmp_name']));
    // $imgData = addslashes($_FILES['userfile']);

    // get the image info..
      $size = getimagesize($_FILES['userfile']['tmp_name']);

    // put the image in the db...
      // database connection
      mysql_connect("localhost", "root", "") OR DIE (mysql_error());

      // select the db
      mysql_select_db ("bena") OR DIE ("Unable to select db".mysql_error());

    // our sql query
    $sql = "INSERT INTO testblob
            ( image_id , image_type ,image, image_size, image_name)
            VALUES
            ('', '{$size['mime']}', '{$imgData}', '{$size[3]}', '{$_FILES['userfile']['name']}')";

    // insert the image
    if(!mysql_query($sql)) {
        echo 'Unable to upload file';
        }
    }
}
else {
     // if the file is not less than the maximum allowed, print an error
     echo
      '&lt;div&gt;File exceeds the Maximum File limit&lt;/div&gt;
      &lt;div&gt;Maximum File limit is '.$maxsize.'&lt;/div&gt;
      &lt;div&gt;File '.$_FILES['userfile']['name'].' is '.$_FILES['userfile']['size'].' bytes&lt;/div&gt;
      &lt;hr /&gt;';
     }
}
</code></pre>

<p>?></p>
