Posted by alexandis on 11/14/07 20:55
i tried to open file in write mode and oops! now it's zero... maybe i
should have used w+... :(
Is it correct and safe like following?
if ($handle = opendir($sourcefile_dir)) {
while (false !== ($filename = readdir($handle))) {
if ($filename != "." && $filename != ".." && is_file($sourcefile_dir.
$filename)) {
$fp = fopen($sourcefile_dir.$filename, "w+");
if (flock($fp, LOCK_EX)) {
?>
Outputting file info
<?php
flock($fp, LOCK_UN);
}
fclose($fp);
}
}
closedir($handle);
}
?>
Navigation:
[Reply to this message]
|