[Php-avanzado] error subida multiple

Maia C maiacordero en gmail.com
Mie Oct 13 08:48:07 ART 2010


Holis intento subir varios archivos a la ves me dice que cargados con exito
pero cuando voy al directorio no estan. Verifique los permisos tienen 666.
Alguna idea de que sucede?


<?php
>     define( "DIRECTORIO", "dir_ejer6" );
>
>     function guardar ($key, $nom) {
>         if (is_uploaded_file( $_FILES[$key]['tmp_name']) ) {
>             $ruta = DIRECTORIO . '/' . $nom;
>             move_uploaded_file( $_FILES[$key]['tmp_name'], $ruta );
>             $res = "El archivo $nom se ha cargado con exito";
>         } else {
>             $res = "El archivo $nom no se pudo cargar";
>         }
>         return $res;
>     }
> ?>
> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
>     "http://www.w3.org/TR/html4/loose.dtd">
> <html>
>     <head>
>         <title> class3 ejer6 </title>
>     </head>
>     <body>
> <?php
> //print "SOY POST";
> //print_r ($_POST);
>
>         if (isset($_POST['btnSubir'])) {
>
> //print "<br><br>SOY FILES<br><br>";
> //print_r ($_FILES);
> //print "<br><br><br>";
>
>         foreach ($_FILES as $key => $valor) {
>             if ($_FILES[$key]['error'] == 0) {
>                 $msj = guardar($key, $_FILES[$key]['name']);
>                 print "<br>Respuesta: $msj<br><br>";
>             }
>         }
>     }
>
>     $dir = scandir( DIRECTORIO , 1);
>     $dir = array_diff( $dir, array( '.', '..' ) );
> ?>
>         <table>
>             <tr>
>                 <th> Clave </th>
>                 <th> Valor </th>
>                 <th> Bajar </th>
>             </tr>
> <?php
>         if ( count( $dir ) > 0) {
>         foreach ($dir as $key => $valor) {
>                 print "<tr>";
>                 print "<td>".$key."</td>";
>                 print "<td>".$valor."</td>";
>                 print '<td><a href="' . DIRECTORIO . '/' . $valor . '">
> Down </a></td>';
>                 print "</tr>";
>         }
> ?>
>         </table>
> <?php
>         } else {
>             print '<tr><td colspan="3">NO HAY ARCHIVOS PARA
> MOSTRAR</td></tr>';
>         }
> ?>
>         <form action="class3ejer6.php" name="subir_varios" method="post"
> enctype="multipart/form-data">
>             <fieldset>
>                 <legend>Ingrese los archivos</legend>
>                 <label>Archivo 1</label><br>
>                 <input type="file" name="1"><br>
>                 <label>Archivo 2</label><br>
>                 <input type="file" name="2"><br>
>                 <label>Archivo 3</label><br>
>                 <input type="file" name="3"><br>
>                 <label>Archivo 4</label><br>
>                 <input type="file" name="4"><br>
>                 <label>Archivo 5</label><br>
>                 <input type="file" name="5"><br>
>                 <br>
>                 <input type="submit" name="btnSubir" value="Subir">
>             </fieldset>
>         </form>
>     </body>
> </html>
>
------------ próxima parte ------------
Se ha borrado un adjunto en formato HTML...
URL: http://www3.fi.mdp.edu.ar/pipermail/php-avanzado/attachments/20101013/734fe0ec/attachment-0001.htm 


Más información sobre la lista de distribución Php-avanzado