Re: [PHP] Php Dynamic Pages Apache Server

2002-08-01 Thread Lee

You could try using the readdir function to read a list of files (full docs
available from http://www.php.net/manual/en/function.readdir.php)

Here is an expanded version of the example give on the above link.

html
body
File List
?php
if ($handle = opendir('./)) {
/* This is the correct way to loop over the directory. */
while (false !== ($file = readdir($handle))) {
echo a href='$file'$file/abr;
}
closedir($handle);
}
?
/body
/html

This example assumes that the PHP script and files are in the same directory
and are all publically accessible (i.e. a user could simple type
http://www.example.com/filename)

Hope this helps

Regards

Lee

- Original Message -
From: [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Thursday, August 01, 2002 5:57 PM
Subject: [PHP] Php Dynamic Pages  Apache Server


 I am trying to create a php page that will show the files on an apache
server.
 Each file will show up as a link on the page.  When clicked, the user will
be
 able to download the file. Is there anyone out there that can lead me in
the
 right direction.

 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php







-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Php Dynamic Pages Apache Server

2002-08-01 Thread Nicole Lallande

This will read all '.pdf' files in a sub-directory and put them in a link -

HTH,

Nicole


?php // read the contents of this directory
$dir = ('./accessories/');

$dir_stream = @ opendir($dir)
or die (Could not open a directory stream for 
i$dir/i.);

while($entry = readdir($dir_stream)) {

  // get the file extention
  $ext = substr($entry, strrpos($entry,'.'));

  // print the link to the file
  if ($ext == '.pdf') {
echo a href='$entry'$entry/abr /;
  }
}
 ?

[EMAIL PROTECTED] wrote:

I am trying to create a php page that will show the files on an apache server.
Each file will show up as a link on the page.  When clicked, the user will be
able to download the file. Is there anyone out there that can lead me in the
right direction.


-- 

Nicole Lallande
[EMAIL PROTECTED]
760.753.6766





-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php