# Error help

**URL:** https://forum.kirupa.com/t/error-help/259463
**Category:** Uncategorized
**Created:** [May 5, 2008, 6:10pm UTC](https://forum.kirupa.com/t/error-help/259463 "2008-05-05T18:10:04Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![jasonhardwick](https://avatars.discourse-cdn.com/v4/letter/j/c68b51/32.png) [@jasonhardwick](https://forum.kirupa.com/u/jasonhardwick)
#### Post date: [May 5, 2008, 6:10pm UTC](https://forum.kirupa.com/t/error-help/259463/1 "2008-05-05T18:10:04Z")

</div>

Hi all…

Ok i’m building a forum with images and here is my code

```php
<?
include "config.php";
$tbl_name="forum_question";

$topic=$_POST['topic'];
$detail=$_POST['detail'];
$name=$_POST['name'];
$email=$_POST['email'];
$username=$_POST['username'];

$datetime=date("d/m/y h:i:s"); //create date time

$hndl=fopen($_REQUEST["imgfile"],"r"); 
  $isize=sizeof($_REQUEST["imgfile"]); 

  $imgdata=""; 
  while(!feof($hndl)){ 
    $imgdata.=fread($hndl,$isize); 
  }; 
  
  $imgdata=addslashes($imgdata); 

$sql="INSERT INTO $tbl_name(username, topic, detail, name, email, datetime)VALUES('$username', '$topic', '$detail', '$name', '$email', '$datetime')";

$sql = "INSERT INTO $tbl_name VALUES(NULL,'". $_REQUEST["imgtype"] ."','". $imgdata ."')"; 
  
$result=mysql_query($sql);

    fclose($hndl);

  echo "<a href=\"test_imagedb_view.php\">view image</a>";

if($result){
echo "Sucess!!<BR>";
echo "<a href=main_forum.php>View your topic</a>";
echo "<br />";
echo "<a href=main_forum.php>Return to Post Home</a>";
}
else {
echo "ERROR";
}
mysql_close();
?>

```

but it keeps returning this error any ideas why?

Warning: feof(): supplied argument is not a valid stream resource in /home/content/j/a/s/jasonhardwick/html/add\_topic.php on line 101

Warning: fread(): supplied argument is not a valid stream resource in /home/content/j/a/s/jasonhardwick/html/add\_topic.php on line 102
