Hi,
I am trying to set up a dynamic flash gallery that will read the files inside a folder then use that data to populate the gallery.
I’m almost done!
I would like the folder that the PHP code searches in to be loaded in from flash.
I have tried to use LoadVariables as in below:
var currentFolder:String = "folderPath"
_root.loadVariables( "pathtoPHPfile", "POST");
the php code looks like this…
$folder = $_POST["currentFolder"];
function show_dir($dir, $pos=2)
{
if($pos == 2)
{
echo "<?xml version=\"1.0\" encoding=\"iso-8859-1\"?>
";
echo "<pics>
";
}
$handle = @opendir($dir);
while ($file = @readdir ($handle))
{
if (eregi("^\.{1,2}$",$file))
{
continue;
}
$string = $file;
$string_length = strlen($string);
$firstpart = strtok($string,"_");
$firstpart_length = strlen($firstpart);
$firstpart_length++;
$char_count = $string_length - $firstpart_length;
$final_part = substr($string,$firstpart_length,$char_count);
echo " <pic>
";
echo " <path>" . $file. "</path>
";
echo " <title>" . $final_part. "</title>
";
echo " </pic>
";
}
@closedir($handle);
if($pos == 2)
{
echo "</pics>
";
}
}
show_dir($folder);
If I hard code in the folder for the “show_dir” funciton, everything works perfect… So, I dont think the problem is in show_dir. However, if I try to load in the folder variable nothing happens. Seems like the variable is not getting from flash to the php script
any ideas at all?
is there a better way to go about this??
any help would be great
-=b=-
www.b-ed.com