fgets help
I cant figure out why this is not working I donot get any error messages just a blank space even $value is not echoning out when enclosed with the fgets()?
I have reduced the code to the problem areas as I see it
$uploaddir = './'; // same folder as this file set permission to 0777
$pedupload = $uploaddir . basename($_FILES['pedfile']['name']);
$datupload = $uploaddir . basename($_FILES['datfile']['name']);
followed by
foreach ($match as $value)
{
$handle = fopen($pedupload, "r");
if (!$handle) {
echo "Could not open file $pedupload";
}
else
{
$buffer = fgets($handle, 4096);
while (!feof($handle)) {
echo $buffer." ".$value."<br />";
}
fclose($handle);
}
where $value is
$datlines = file($datupload);
$datlines_implode = implode(" " , $datlines);
$regex = '/(\w[0-9]+s[0-9]+)/';
preg_match_all($regex , $datlines_implode , $matched);
$match = Array();
foreach($matched[0] as $key=>$value){
array_push($match,$value);
}
Like I said value on its own does work nicely it is just when I try to combine it with the other file.
Any ideas?