Board index   FAQ   Search  
Register  Login
Board index php forum :: php coding PHP coding => General

filename in a directory

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

filename in a directory

Postby fabrizzio » Mon Dec 30, 2002 4:51 pm

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
User avatar
fabrizzio
New php-forum User
New php-forum User
 
Posts: 10
Joined: Fri Dec 13, 2002 2:22 pm

Postby Joan Garnet » Tue Dec 31, 2002 6:34 am

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!
User avatar
Joan Garnet
Moderator
Moderator
 
Posts: 387
Joined: Sat Aug 03, 2002 2:56 am
Location: Mars


Return to PHP coding => General

Who is online

Users browsing this forum: No registered users and 2 guests

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.