Ver Mensaje Individual
  #1 (permalink)  
Antiguo 10/09/2012, 11:27
xoceunder
 
Fecha de Ingreso: junio-2012
Ubicación: En el Mundo
Mensajes: 759
Antigüedad: 11 años, 10 meses
Puntos: 10
duda de como hacer un loading al subir archivos

Hola a todos es que queiro poder colocar un loading para subir archivos y tengo esto ya echo

Código PHP:
Ver original
  1. <?php
  2. $status = "";
  3. if ($_POST["action"] == "upload") {
  4.     // obtenemos los datos del archivo
  5.     $tamano = $_FILES["archivo"]['size'];
  6.     $tipo = $_FILES["archivo"]['type'];
  7.     $archivo = $_FILES["archivo"]['name'];
  8.     $prefijo = substr(md5(uniqid(rand())),0,6);
  9.    
  10.     if ($archivo != "") {
  11.         // guardamos el archivo a la carpeta files
  12.         $destino =  "files/".$archivo;
  13.         if (copy($_FILES['archivo']['tmp_name'],$destino)) {
  14.             $status = "Archivo subido: <b>".$archivo."</b>";
  15.         } else {
  16.             $status = "Error al subir el archivo";
  17.         }
  18.     } else {
  19.         $status = "Error al subir archivo";
  20.     }
  21. }
  22. ?>
  23. <html>
  24. <head>
  25. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  26. <title>PHP upload</title>
  27. <link href="estilo.css" rel="stylesheet" type="text/css" />
  28. </head>
  29. <body>
  30. <table width="413" border="0" cellspacing="0" cellpadding="0">
  31.   <tr>
  32.     <td width="413" height="40" class="titulo">PHP upload</td>
  33.   </tr>
  34.   <tr>
  35.     <td class="text">Por favor seleccione el archivo a subir:</td>
  36.   </tr>
  37.   <tr>
  38.   <form action="upload.php" method="post">
  39.     <td class="text">
  40.       <input name="archivo" type="file" class="casilla" id="archivo" size="35" />
  41.       <input name="enviar" type="submit" class="boton" id="enviar" value="Upload File"/>
  42.       <input name="action" type="hidden" value="upload"/>     </td>
  43.     </form>
  44.   </tr>
  45.   <tr>
  46.     <td class="text" style="color:#990000"><?php echo $status; ?></td>
  47.   </tr>
  48.   <tr>
  49.     <td height="30" class="subtitulo">Listado de Archivos Subidos </td>
  50.   </tr>
  51.   <tr>
  52.     <td class="infsub">
  53.     <?php
  54.     if ($gestor = opendir('files')) {
  55.         echo "<ul>";
  56.         while (false !== ($view = readdir($gestor))) {
  57.            if ($view != "." && $view != "..") {
  58.                echo "<li><a href=\"files/".$view."\" class=\"linkli\">".$view."</a></li>\n";
  59.            }
  60.         }
  61.         closedir($gestor);
  62.         echo "</ul>";
  63.     }
  64.     ?>  </td>
  65.   </tr>
  66. </table>
  67. </body>
  68. </html>