Debt Consolidation - Debt Consolidation - Customer services - Debt Consolidation - Just Holden Commodores

PDA

View Full Version : Why php script for read directory not update content change


fisad
Oct 15th 2008, 8:35 am
I try read directory conten changes from php script, at first time of run script from my flex application result script is ok, but when I try a second and another time, result is the same how first time, directory changes are not show in result of script (data is put in xml code for read from flex service).

I have another scripts and result of them are ok, this scripts get data from data base, so, my flex code is ok for services update.

Directory conten is change for another php script, this script add new image files to directory, but when I run php script for read directory content, result not include new files added.

Php code is:


<?php
header( "cache-control: private" );
header( "pragma: no-cache" );
header("Content-Type: text/xml");
echo "<?xml version=\"1.0\" encoding=\"utf-8\"?>"."\n";
$directory = "../".$_GET['directory'];
echo "<gallery>"."\n";
ExportDirectoryXML($directory);
echo "</gallery>";

function ExportDirectoryXML($base)
{
if ($dir = @opendir($base))
{
while (($file = readdir($dir)) !== false)
{
if ($file{0} != ".")
{
if (is_dir($base . "/" . $file))
{
}
else
{
$ext = @substr($file, (@strrpos($file, ".") ? @strrpos($file, ".") : @strlen($file)), @strlen($file));
$fname = basename($file,$ext);
$imgsrc= $base . "/" . $file;
$imgsrc= substr($imgsrc, 3);
echo "<image>"."\n";
echo "<label>".$file."</label>"."\n";
echo "<path>".$imgsrc."</path>"."\n";
echo "</image>"."\n";
}
}
} //end while
closedir($dir);
} // end if
} //end function
?>



When I execute my application again, result is ok, directory changes are showed.

Please, any direction for a good solution.

Thank in advance.

fisad
Oct 15th 2008, 10:06 am
problem resolved