Re: Listing files
| From: | George Nicolae | Date: | Mon, 31 Dec 2001 17:00:07 +0000 |
| Subject: | Re: Listing files | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-79126@lists.php.net to get a copy of this message | ||
$path="c:/";//your path
function GetDirArray($sPath)
{
//Load Directory Into Array
$handle=opendir($sPath);
while ($file = readdir($handle)) if(($file!=".")&($file!=".."))
$retVal[(isset($retVal))?count($retVal):0] = $file;
//Clean up and sort
closedir($handle);
sort($retVal);
return $retVal;
}
$a=GetDirArray($path);
//echo "test".count($a);
//for ($i=0;$i<count($a);$i++) echo $a[$i]."<br>";
?>
<select name="select">
<?
for ($i=0;$i<count($a);$i++) {
?>
<option value="test" onchange='location="//go to the specific location
and/or file"'><?echo $a[$i];?></option>
<?
}
?>
</select>
--
Best regards,
George Nicolae
IT Manager
___________________
X-Playin - Professional Web Design
www.x-playin.f2s.com
"Todd Cary" <todd@aristesoftware.com> wrote in message
news:3C3091D1.40FE5F87@aristesoftware.com...
> I would like to present the surfer with a list of files in a directory
> (I'll probably put then into a drop-down) and then I want to send the
> file to the surfer if one is selected. I am not sure of the syntax to
>
> 1) List the files in a directory
>
> 2) Send a selected file to the surfer
>
> Many thanks for any help in getting the correct syntax to do this......
>
> Todd
>
> --
> Todd Cary
> Ariste Software
> todd@aristesoftware.com
>
>