Código PHP:
  
<body> 
<form method=post action=buscar2.php>
 
buscar
 
<INPUT TYPE="text" size="15" name="caja1">
 
<input type="submit" value="Validar"><br>
<?php 
 
$file=$_REQUEST ["caja1"];
 
 echo "$file <br>";
 
 
function dirImages($dir) {
$d = dir($dir); //Open Directory
while (false!== ($file = $d->read())) //Reads Directory
{
$extension = substr($file, strrpos($file, '.')); // Gets the File Extension
if($extension == ".pdf" ) // Extensions Allowed
$images[$file] = $file; // Store in Array
}
$d->close(); // Close Directory
asort($images); // Sorts the Array
 
return $images; //Author: ActiveMill.com
}
 
$array = dirImages('C:\wamp\www');
 
foreach ($array as $key => $image) // Display Images
{
echo "<a href='$image'>$image</a><br>";
echo '<br />';
} 
?> 
 
 
 
</body>   
 

