Code Library
Home Submit Free Hosting Link To Us Contacts

PHP File Search in directory and display

PHP File Search in directory and display PHP PHP File Search in directory and display Download (.zip)



<?
$dir = "/home/dir/"; // //directory were your files are
$thething = $what; //stores what string to search
$link = "http://example.com/dir/"; //link to the folder were the files are, but outer
$dir = opendir($dir);
while($file = readdir($dir)) {
        if ( $file == $thething ) {
                $list = "<table width=500 border=1>";
                $list .= "<tr><td width=500><center><b>Click To Download</b></center>";
                $list .= "<tr><td width=500><a href='$link$file'>$file</a></center>";
                $list .= "</table>";
                echo $list;
        }
        else { }
}
?>






Tatet