You are here: Get list of files in a specified folder on server « PHP Language « IT news, forums, messages
Get list of files in a specified folder on server

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;
}
?>

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация