Ver Mensaje Individual
  #3 (permalink)  
Antiguo 16/04/2007, 09:03
Avatar de gerson
gerson
 
Fecha de Ingreso: febrero-2005
Ubicación: Lima
Mensajes: 481
Antigüedad: 19 años, 2 meses
Puntos: 4
Re: checkbox y ficheros de directorio

Hola estibaliz2006, haber si este codigo te sirve es muy basico pero funciona
Código PHP:
$path "dir";
if(isset(
$_POST['archivo'])){
    for(
$i=0;$i<sizeof($_POST['archivo']);$i++){
        
unlink($path '/' $_POST['archivo'][$i]);
    }
    
header('Location: test.php');
}
echo 
'<form name="frm" method="post" action="test.php">';
echo 
'<table cellspacing="0" cellspadding="0" border="1">';
echo 
'<tr>';
echo 
'<td colspan="2">para los marcados<input type="submit" value="Eliminar"></td>';
echo 
'</tr>';
echo 
'<tr>';
echo 
'<td>&nbsp;</td><td>Archivo</td>';
echo 
'</tr>';
if (
$handle opendir($path))  
    { 
    while (
false !== ($file readdir($handle))) { 
        if (
$file != "." && $file != "..") {     
            
$fName $file
            
$file $path.'/'.$file
            if(
is_file($file)){////si es un fichero  
                
echo '<tr>';
                echo 
'<td><input type="checkbox" name="archivo[]" value="'.$fName.'"></td>';
                echo 
"<td><a href='".$file."'>".$fName."</a></td>";
                echo 
'</tr>';
            }
        }
    }
}
echo 
'</table>';
echo 
'</form>'
Saludos
__________________