Ver Mensaje Individual
  #1 (permalink)  
Antiguo 06/06/2013, 09:53
eprado
 
Fecha de Ingreso: septiembre-2007
Mensajes: 40
Antigüedad: 16 años, 7 meses
Puntos: 0
Ordenar Archivos Subidos Por Upload

Buenos días, Tengo un gesto para subir archivos el cual funciona bien, pero al momento de mostarlos lo hace de forma desordenada es decir:

1--- Archivo 1
100---Archivo
2--- Archivo

Como Podran Ver cuando llega al 100 se coloca detras del numero 1 al igual pasa con el 200 y 300 me gustaria saber como hago para que siga la secuencia

A continuacion el codigo:
Código PHP:
<?php 
$status 
"";

$action = isset($_POST['action']) ? $_POST['action'] : 'archivo'
  if (
$action == "upload" ){
    
// obtenemos los datos del archivo 
    
    
$tamano $_FILES["archivo"]['size'];
    
$tipo $_FILES["archivo"]['type'];
    
$archivo $_FILES["archivo"]['name'];
    
$prefijo $_POST["dato"];
    
    if (
$archivo != "") {
        
// guardamos el archivo a la carpeta files
        
$destino =  "files/".$prefijo."---".$archivo;
        
        
        if (
file_exists("files/" $_FILES['archivo']['tmp_name'])) {
          
$destino=  $_FILES['archivo']['tmp_name'] . " ya existe. ";
        }
        else{
        if (
copy($_FILES['archivo']['tmp_name'],$destino)) {
            
$status "Archivo subido: <b>".$archivo."</b>";
            
        
        } else {
            
$status "Error al subir el archivo";
        }
    
    }
    }

    
 

}

?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Subir Guiones</title>
<link href="estilo.css" rel="stylesheet" type="text/css" />
</head>
<body>
<table width="413" border="0" cellspacing="0" cellpadding="0" align="center" >
  <tr>
    
   
    <td width="413" height="40" align="center"><a href="index.php?menu=Principal"><img src="images/tv_ead.jpg" width="225" height="100" align="absbottom" border="0"> </td>
  
 
  </tr>
  
  
  <table border="0" align="center">
  <tr>
    <td class="text">Por favor seleccione el archivo a subir: <a href="MODELO GUIÓN AUDIOS.docx">Modelo de Guion</a></td>
  </tr>
  <tr>
  
  <form action="upload.php" method="post" enctype="multipart/form-data">
    <td class="text">
      Nro Solicitud
      <input name="dato" type="text" class="casilla" id="dato" size="20"  />
      <input name="archivo" type="file" class="casilla" id="archivo" size="35" />
      <input name="enviar" type="submit" class="boton" id="enviar" value="Subir Guion" />
      <input name="action" type="hidden" value="upload" />      
       
      
      </td>
      
    </form>
  </tr>

  <tr>
    <td class="text" style="color:#990000"><?php echo $status?></td>
  </tr>
 
  <tr>
   
  </tr>
  <tr>
     </table>
    
    <table border="0" align="left">
    <tr>
    <td height="30" class="subtitulo">Listado de Archivos Subidos <img src="images/modif.png" width="50" height="50" align="absbottom" border="0"> </td>
  </tr>
    <td class="infsub">
      
    <?php 
    


    
if ($gestor opendir('files')) {
        echo 
"<ul>";
        while (
false !== ($arch readdir($gestor))) {
          
           
          if (
$arch != "." && $arch != "..") {
             
            
               echo 
"<li><a href=\"files/".$arch."\" class=\"linkli\">".$arch."</a></li>\n";
           }
        }
        
closedir($gestor);
        echo 
"</ul>";
    }
    
?>    </td>
  </tr>
<tr>
</table>
</body>
</html>