Ver Mensaje Individual
  #1 (permalink)  
Antiguo 10/02/2011, 21:44
rafaeltesi
 
Fecha de Ingreso: febrero-2011
Mensajes: 3
Antigüedad: 15 años, 7 meses
Puntos: 0
insetar un textbox para buscar nombre de archivos

que tal, miren tengo el siguiente codigo, donde he insertardo un textbox, pero el problema es q no se como declarar para q me busque los archivos pdf, ya tengo el codigo para me muestre el contenido de un directorio todos los pdf. alguien me puede ayudar.


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>