hello there i just need some help dont know why it gave's me an error..
i have 3 files on my folder the filenames are
test1.dat, test2.dat & test3.dat
each .dat file contains a value 09174337421|20030704145800|20030704145801|2311|STATUS PR730 and i have to strip it out from my code
so i did this kind of code
$dir = "c:/server/data";
if ($handle = opendir($dir)) {
while (false !== ($file = readdir($handle))) {
if ($file != "." && $file != ".." && preg_match ("/.DAT/", $file)) {
//echo "<a href=\"$dir/$file\" target=\"_blank\">$file</a><br />\n";
$files[] = $file;
}
}
closedir($handle);
}
$i = -1;
while ($i != count($files)){
$handle = fopen ($dir.'/'.$files[$i],"r");
$i++;
$row = 1;
while ($data = fgetcsv ($handle, 1000, "|")) {
$num = count ($data);
$row++;
for ($c=0; $c < $num; $c++) {
print $data[$c] . "<br>\n";
}
}
fclose ($handle);
}
the error displayed like this
fopen("c:/server/data/", "r") - Permission denied
why it cant read the filenames from files[]?
help pls