Please Check my Code
Posted: Sat Dec 03, 2005 8:04 am
I'm currently using this piece of PHP to print out an XML document to be used i flash it works very well:
However I want to start to post a variable from flash that defines which directory to open (currently defined as "portfolio"). I'm trying the code below to define the directory as a variable without success, I'm not sure if the problem is here in the PHP or in my Actionscript. If there are problems here could somene be kind enough to point them out to me:
Code: Select all
<?php
echo "<?xml version=\"1.0\" encoding =\"ISO-8859-1\" ?>\n";
echo "<images>\n";
if ($handle = opendir('./portfolio')) {
$files_array = array();
// Gather files in array
while (false !== ($file = readdir($handle))) {
if ($file !== "." && $file !== "..") {
list($width, $height) = getimagesize("portfolio/".$file);
$mtime = filemtime("portfolio/" . "$file");
array_push($files_array, array(
'mtime' => $mtime,
'path' => "portfolio/" . "$file",
'width' => $width,
'height' => $height
));
}
}
// Sort array
rsort($files_array);
// Print XML
for ($i=0;$i<count($files_array);$i++) {
echo "<myImage myPath=\"" . $files_array[$i]['path'] ."\" myWidth=\"" . $files_array[$i]['width'] ."\" myHeight=\"" . $files_array[$i]['height'] ."\" />\n";
}
closedir($handle);
}
echo "</images>\n"
?>Code: Select all
....
$myFileName = $_POST["myFileName"];
if ($handle = opendir('./$myFileName'))
.....