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

newbie question

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

newbie question

Postby flash82 » Wed Nov 20, 2002 1:48 am

I have been using this code to search a directory for files and display them as links but I want to search all the directories on my site and display the files. How would I edit my code to do this?

<?php
$dh = opendir("D:\wwwroot");

$filename = $_POST["directory"];

while (!(($file = readdir($dh))===false)){

if(stristr($file, $filename)){

if(strstr($file, ".")){

echo'<a href="'.wwwroot.'/'.$file.'">'.$file.'</a><br>';

}
}
}
closedir($dh);
?>

Thanx in advance.
flash82
New php-forum User
New php-forum User
 
Posts: 2
Joined: Wed Nov 20, 2002 1:41 am

Postby Oleg Butuzov » Wed Nov 20, 2002 2:36 am

change your root dir at the dir to scan for file at the server
Oleg Butuzov
Last Samuray
Last Samuray
 
Posts: 831
Joined: Sun Jun 02, 2002 3:09 am

Postby flash82 » Wed Nov 20, 2002 4:11 am

sorry if i'm just bein a bit slow but how do u do that exactly "scan for a file at the server".

Thanx
flash82
New php-forum User
New php-forum User
 
Posts: 2
Joined: Wed Nov 20, 2002 1:41 am

Postby Oleg Butuzov » Thu Nov 21, 2002 12:10 am

i mean a dir where is will be search
Oleg Butuzov
Last Samuray
Last Samuray
 
Posts: 831
Joined: Sun Jun 02, 2002 3:09 am


Return to PHP coding => General

Who is online

Users browsing this forum: Yahoo [Bot] and 1 guest

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

cron