When executing the following block of code:
foreach($eventfiles as $eventfile)
{
if($eventfile['filename'])
{
$file = $eventfile['filepath'];
// Open File
if( !($fp = fopen($file, "r")))
{
echo '<br>CAN NOT READ FILE.';
exit;
}
// Read data from the file into $data
$data = "";
while (!feof($fp)) $data .= fread($fp,1024);
query("update event_rtab set html = '".escape($data)."' where id = {$eventfile[id]}");
}
if($eventfile['eventType']=='email')
{
query("INSERT INTO event_email_rtab (event_id,subject) values ($eventfile[id],'".escape($eventfile[email_subject])."')");
}
}
The script fails with the following error:
fopen(test.html) [function.fopen]: failed to open stream: Redirection limit reached, aborting in /data/www/example.com/public/test.php on line 843
What causes this error and how can I correct it?