Page 1 of 1

filename in a directory

Posted: Mon Dec 30, 2002 4:51 pm
by fabrizzio
does anybody knows how can i read the directory contents with a remote addr? I mean read all the files placed at:"http://www.server.com/direc"

thanks
fabrizzio

Posted: Tue Dec 31, 2002 6:34 am
by Joan Garnet
If you want to show all contents of a directory just leve it without index page, then you'll be able to do this -->
http://www.server.com/directory/
and you'll see a list of all contents in that dir.

If you want to scan a directory of yours with php use this:

Code: Select all

if ($dir = @opendir("./mydir_from_this_diectory")) {
  while (($file = readdir($dir)) !== false) {
    echo "$file<br>";
  } 
  closedir($dir);
}


bye!