<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Search File</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<?php
$filename = isset($_POST['filename']) ? $_POST['filename']:'';
?>
<form name="form1" method="post" action="search.php">
<input name="filename" type="text" value="<?=$filename?>" id="filename">
<input type="submit" name="Submit" value="Envoyer">
</form>
<?php
function ListeFindedFileAndLink($path,$pattern) {
if (is_dir($path))
{
if ($dh = @opendir($path)) {
while (($file = readdir($dh)) !== false) {
if (($file != '.') && ($file != '..'))
if (is_dir($path . $file))
ListeFindedFileAndLink($path . $file . '/',$pattern);
else
if (ereg($pattern,strtolower($file)))
echo '<a href="'.$path . $file.'">'.$file.'</a><br>';
}
closedir($dh);
}
}
elseif (is_file($path))
if (ereg($pattern,strtolower($file))) echo '<a href="'.$path .'">'.$path .'</a><br>';
}
$directory = "./docs/"; // Spécifier le chemins de ton repertoire le slash inclus
ListeFindedFileAndLink($directory,'('.$filename.')');
?>
</body>
</html>