Error help

Hi all…

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

<?
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