You are here: Re: How to get to know if file is currently being written by another app? « PHP Programming Language « IT news, forums, messages
Re: How to get to know if file is currently being written by another app?

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]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация