Forum Moderators: coopster
Warning: fread(): supplied argument is not a valid stream resource in /home/symmetry/public_html/sitemanage/document/index.php on line 25
Warning: fclose(): supplied argument is not a valid stream resource in /home/symmetry/public_html/sitemanage/document/index.php on line 27
Here is the code:
<?
include '../library/config.php';
include '../library/opendb.php';
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);
$content = addslashes($content);
fclose($fp);
if(!get_magic_quotes_gpc())
{
$fileName = addslashes($fileName);
}
$query = "INSERT INTO documents (name, size, type, content ) ".
"VALUES ('$fileName', '$fileSize', '$fileType', '$content')";
mysql_query($query) or die('Error, query failed');
echo "<h5>File $fileName uploaded</h5>";
}
?>
<h4>Add Document</h4>
<div id="cform">
<form action="" method="post" enctype="multipart/form-data" name="uploadform">
<input type="hidden" name="MAX_FILE_SIZE" value="200000000000000"><input name="userfile" type="file" class="box" id="userfile">
<input name="upload" type="submit" class="box" id="upload" value=" Upload ">
</form>
</div>
Anyone have any ideas on where I am giong wrong?
Warning: fread(): supplied argument is not a valid stream resource in /home/symmetry/public_html/sitemanage/document/index.php on line 25
Warning: fclose(): supplied argument is not a valid stream resource in /home/symmetry/public_html/sitemanage/document/index.php on line 27
Anyone have any ideas at all?
Warning: fread(): supplied argument is not a valid stream resource in /home/symmetry/public_html/sitemanage/document/index.php on line 25
Warning: fclose(): supplied argument is not a valid stream resource in /home/symmetry/public_html/sitemanage/document/index.php on line 27