Ver Mensaje Individual
  #1 (permalink)  
Antiguo 10/02/2011, 12:37
leo2gz
 
Fecha de Ingreso: mayo-2007
Mensajes: 47
Antigüedad: 17 años
Puntos: 0
Pregunta agregar input de archivos al hacer click en link

Holaaa..! quisiera que me ayudaran para poder hacer un form para subir imagenes
por ejemplo: cuando hacemos click en un enlace agregar otra imagen imprima otro input para subir otro archivo y asi sucesivamente.
Algo parecido a lo que utiliza hotmail cuando agregamos archivos adjuntos.

Como podria hacer esto ??
lo trate de hacer de la siguiente forma pero no me sirve de mucho: (agrega solo una vez)


Código PHP:
<table>
    <form action="subir1.php" method="post" enctype="multipart/form-data">
    <tr>
    <td>Imagen 1</td>
    <td>
        <input name="archivo1" type="file" size="26"  onclick="javascript:check();" />
        <input name="action" type="hidden" value="upload" />
    </td>
    </tr>
    
    <tr>
    <td>Agregar Imagen:</td>
    <td><?php 
            $cant
++;
            echo 
"<a href=\"banner1.php?img=$cant\">Agregar otra imagen</a>";
         
?>
        </td>
    </tr>
    
    <?php
    $cant 
$_GET["img"];
    if (
$cant == "1"){
        echo 
"
        <tr>
            <td>Imagen 2:</td>
            <td><input name=archivo2 type=file size=26 />
                <input name=action type=hidden value=upload />
            </td>
        </tr>
        "
;
    }
    
    
$cant $_GET["img"];
    if (
$cant == 2){
        echo 
"
        <tr>
            <td>Imagen 3:</td>
            <td><input name=archivo2 type=file size=26 />
                <input name=action type=hidden value=upload />
            </td>
        </tr>
        "
;
    }
    
    
$cant $_GET["img"];
    if (
$cant == 3){
        echo 
"
        <tr>
            <td>Imagen 4:</td>
            <td><input name=archivo2 type=file size=26 />
                <input name=action type=hidden value=upload />
            </td>
        </tr>
        "
;
    }
    
?>
    
    <tr>
    <td>&nbsp;</td>
    <td><input type="submit" value="Aceptar"  /></td>
    </tr>
    </form>
    </table>