error checking with fread
| From: | John Taylor-Johnston | Date: | Thu, 06 Mar 2003 00:06:32 +0000 |
| Subject: | error checking with fread | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-138396@lists.php.net to get a copy of this message | ||
http://www.php.net/manual/en/function.fread.php
What about error checking if the file contains something as I include below? Is that enough? Is this
the right way?
<?php
$filename = "/usr/local/something.txt";
$handle = fopen ($filename, "r");
$contents = fread ($handle, filesize ($filename));
fclose ($handle);
if ($contents){echo"<form><textarea>$contents</textarea></form>";}
else{echo "no contents there";}
?>