PHP document upload form - error message
<p>I am getting the following message on a PHP document upload form i created:</p>

<p>Warning: fread(): supplied argument is not a valid stream resource in</p>

<p>/home/admin/upload.php on line 129</p>

<p>Warning: fread(): supplied argument is not a valid stream resource in</p>

<p>/home/admin/upload.php on line 131</p>

<p>Here is my code, line 129 and 131 are commented on:</p>

<pre><code>&lt;?
if(isset($_POST['upload']))
{
        $fileName = $_FILES['userfile']['name'];
        $tmpName  = $_FILES['userfile']['tmp_name'];
        $fileSize = $_FILES['userfile']['size'];
        $fileType = $_FILES['userfile']['type'];

        $fp = fopen($tmpName, 'r');
            $content = fread($fp, $fileSize); //Line 129
        $content = addslashes($content);
                fclose($fp); //Line 131

        if(!get_magic_quotes_gpc())
        {
            $fileName = addslashes($fileName);
        }
        $fileName = str_replace(' ','_',$fileName);

        //MySQL Database Connect
include '../includes/dblogin.php';


        $query = "INSERT INTO upload_min (name, size, type, content, types ) ".
                 "VALUES ('$fileName', '$fileSize', '$fileType', '$content', 'minutes')";

        mysql_query($query) or die('Error, query failed');                  

        echo "&lt;p align='center'&gt;File $fileName uploaded&lt;/p&gt; &lt;p align='center'&gt;&lt;a href='index.php'&gt;Go back to Admin&lt;/a&gt;&lt;/p&gt;";
}       
?&gt;
</code></pre>

<p>my users are only uploading MS word documents. so i dont know if it is because the file name could be too long... </p>

<p>i have a page that calls the dbase and displays the files and there are .doc and .docx files.... so i dont think the file extension is an issue... plust i just uploaded a .pdf file and it worked fine...</p>

<p>anyone? </p>
