I hope this is the right place for this post. I am trying to trace a list of all file names in a directory using php. Unfortunately i don’t know how to use php and am trying to modify a code i found on the internet. any help would be appreciated.
My php code looks like this:
<?
$dir = 'CastingSoundFiles/MissA';
$dirHandle = opendir($dir);
$count = -1;
$returnstr = "";
while ($file = readdir($dirHandle)) {
if(!is_dir($file) && strpos($file, '.mp3')>0) {
$count++;
$returnstr .= '&f'.$count.'='.$file;
}
}
$returnstr .= '&';
echo $returnstr;
closedir($dirHandle);
?>
and I’m loading it in flash like this:
package
{
import flash.events.*
import flash.net.*;
public class GetFiles
{
var loader:URLLoader = new URLLoader();
public function GetFiles()
{
loader.addEventListener(Event.COMPLETE, useData);
loader.load(new URLRequest("readfromdir.php"));
}
function useData(event:Event):void {
var data:String = event.target.data.toString();
trace(data);
}
}
}
this just traces the php file. how do i run this php code to get the returnstr variable.
Thanks for help sorry im so confused.