Ver Mensaje Individual
  #4 (permalink)  
Antiguo 19/04/2007, 14:37
Avatar de gerson
gerson
 
Fecha de Ingreso: febrero-2005
Ubicación: Lima
Mensajes: 481
Antigüedad: 19 años, 2 meses
Puntos: 4
Re: subir nivel en subdirectorios casi solucionado

Hola estibaliz2006 en tu post anterior puse es codigo pero sin el subir nivel, pues a este le agrege eso de subir nivel.
Código PHP:
if (isset($_GET['dir'])){
    
$path $_GET['dir'];    
}else{
    
$path "dir";
}
$rutas explode('/',$path);
if(isset(
$_POST['archivo'])){
    for(
$i=0;$i<sizeof($_POST['archivo']);$i++){
        if (
is_file($path '/' $_POST['archivo'][$i])){
            
unlink($path '/' $_POST['archivo'][$i]);
        }else{
            
rmdir($path '/' $_POST['archivo'][$i]);
        }
    }
    
header('Location: test2.php?dir='.$path);
}
if (
$rutas !== false){
    
$url '';
    
$len sizeof($rutas) - 1;
    for(
$i=0;$i<$len;$i++){
        
$url .= $rutas[$i] .'/';
    }
    
$url substr($url,0,-1);
    echo 
'<a href="test2.php?dir='.$url .'">'.$url.'</a>';
}
echo 
'<form name="frm" method="post" action="test2.php?dir='.$path.'">';
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>';
            }else{
                if(
$handle2 opendir($file)){
                    
$contador 0;
                    while (
false !== ($file2 readdir($handle2))){
                        
$contador++;
                    }
                }
                if (
$contador == 2){
                    
$check '<input type="checkbox" name="archivo[]" value="'.$fName.'">';
                }else{
                    
$check '&nbsp;';
                }
                echo 
'<tr>';
                echo 
'<td>'.$check.'</td>';
                echo 
"<td><a href='test2.php?dir=".$file."'>".$fName."</a></td>";
                echo 
'</tr>';
            }
        }
    }
}
echo 
'</table>';
echo 
'</form>'
Saludos
__________________