|
Posted by David on 10/12/05 04:56
Hi All,
I'm new to PHP and am trying to get the file contents of a folder. I have
this code below but it is failing. Can a keen eye spot where I am going
wrong?
If not could you point me to a tutorial or the like?
Thanks, David
<?
session_start();
session_register("imagecount_session");
session_register("imagepath_session");
?>
<?
ListFolderContents($DOCUMENT_ROOT.$_GET["folder"]);
function ListFolderContents($path)
{
extract($GLOBALS);
$fs=$CreateObject["Scripting.FileSystemObject"]
$folder=$fs->GetFolder $path);
$imagecount_session=$folder->Files.$Count;
foreach ($folder Files as $item)
{
$i=$i+1;
$url=MapURL($item->path);
session_register("iCount".$i);
${"iCount".$i."_session"}=$item->Name;
} return $function_ret;
}
for ($j=1; $j<=$imagecount_session; $j=$j+1)
{
$a[$j]=${"iCount".$j."_session"};
}
$s=$Join[$a][","];
function MapURL($path)
{
extract($GLOBALS);
$rootPath=$DOCUMENT_ROOT."/";
$url=substr($path,strlen($path)-(strlen($path)-strlen($rootPath)));
$MapURL=str_replace("\","/",$url);
$imagepath_session=$MapURL;
return $function_ret;
}
?>
[Back to original message]
|