Foros del Web » Programando para Internet » Javascript »

File Upload Dinamico Problema

Estas en el tema de File Upload Dinamico Problema en el foro de Javascript en Foros del Web. En el siguiente por medio a la invocacion de una funcion voy agregando el control <input type="file" /> dinamicamente el problema es que no puedo ...
  #1 (permalink)  
Antiguo 12/12/2006, 12:26
Avatar de BatusaiX  
Fecha de Ingreso: diciembre-2001
Ubicación: Santo Domingo - Rep. Dom.
Mensajes: 63
Antigüedad: 22 años, 4 meses
Puntos: 0
Exclamación File Upload Dinamico Problema

En el siguiente por medio a la invocacion de una funcion voy agregando el control <input type="file" /> dinamicamente el problema es que no puedo sacar el value hice lo mismo pero con textbox y funciono perfectamente, parece que es alguna restriccion que existe a la hora de alterar dinamicamente el value de este control, alguien tiene alguna solucion ??

Código PHP:
<html>

<
head>

<
title>Subir M&uacute;ltiples Archivos</title>
<
script type="text/javascript">
<!--

var 
files = new Array();

function 
AgregarFileInput()
{
    
files[files.length] = "";
    
RefrescarArchivos();
}

function 
RefrescarArchivos()
{
    
document.getElementById("archivos").innerHTML "";

    var 
0;
    for (
0files.lengthi++)
    {
        if (
files[i] != undefined)
        {
            
document.getElementById("archivos").innerHTML += "<input id=\"archivo"+i+"\" type=\"file\" name=\"archivos[]\" onchange=\"GuardarInfo("+i+", this.value)\"><label onclick=\"QuitarFileInput("+i+")\">X</label>";
            
//document.getElementById("archivo"+i).value = files[i];
            
if (!= files.length 1)
                
document.getElementById("archivos").innerHTML += "<br>";
        }
    }
}

function 
GuardarInfo(indicevalor)
{
    
files[indice] = valor;
}

function 
QuitarFileInput(indice)
{
    var 
0;
    for (
indicefiles.length 1i++)
    {
        
files[i] = files[i+1];
    }
    
files[files.length-1] = undefined;
    
    
RefrescarArchivos();
}

-->
</script>

</head>

<body>

<h3>Archivos:</h3><br>
<div id="archivos"></div><br>
<label onclick="AgregarFileInput()">Agregar</label>

</body>

</html> 


aqui el mismo codigo pero con textbox funcionando:

Código PHP:
<html>

<
head>

<
title>Subir M&uacute;ltiples Archivos</title>
<
script type="text/javascript">
<!--

var 
files = new Array();

function 
AgregarFileInput()
{
    
files[files.length] = "";
    
RefrescarArchivos();
}

function 
RefrescarArchivos()
{
    
document.getElementById("archivos").innerHTML "";

    var 
0;
    for (
0files.lengthi++)
    {
        if (
files[i] != undefined)
        {
            
document.getElementById("archivos").innerHTML += "<input value=\""+files[i]+"\"\" type=\"text\" name=\"archivos[]\" onchange=\"GuardarInfo("+i+", this.value)\"><label onclick=\"QuitarFileInput("+i+")\">X</label>";
            if (
!= files.length 1)
                
document.getElementById("archivos").innerHTML += "<br>";
        }
    }
}

function 
GuardarInfo(indicevalor)
{
    
files[indice] = valor;
}

function 
QuitarFileInput(indice)
{
    var 
0;
    for (
indicefiles.length 1i++)
    {
        
files[i] = files[i+1];
    }
    
files[files.length-1] = undefined;
    
    
RefrescarArchivos();
}

-->
</script>

</head>

<body>

<h3>Archivos:</h3><br>
<div id="archivos"></div><br>
<label onclick="AgregarFileInput()">Agregar</label>

</body>

</html> 
__________________
"Algunas personas nunca aprenden nada, porque todo lo comprenden demasiado pronto."

Alexander Pope
  #2 (permalink)  
Antiguo 26/12/2006, 14:19
 
Fecha de Ingreso: noviembre-2005
Ubicación: Torreon Coahuila
Mensajes: 100
Antigüedad: 18 años, 5 meses
Puntos: 1
Re: File Upload Dinamico Problema

Aqui un Link

h**p://***..telefonica.net/web2/blas-mar/crear.html

Aqui Otro
h**p://***.cristalab.com/tips/32381/subir-multiples-archivos-con-php

Saludos
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 06:13.