Ver Mensaje Individual
  #2 (permalink)  
Antiguo 19/05/2009, 03:23
fatasma
Usuario no validado
 
Fecha de Ingreso: octubre-2008
Ubicación: BRUSELAS
Mensajes: 211
Antigüedad: 15 años, 5 meses
Puntos: 3
Respuesta: recoger contenido de campos typo file creados por js

Bueno les pongo el codigo por si alguien me puede ayudar

con este codig intento mostrar el contenido del array
Código PHP:
<?php
    
if(isset($_POST['envoyerfichiers']))
    {
        echo 
"envoyé";
        
        echo 
"<pre>";
        
print_r($_FILE);
        echo 
"</pre>";
    }
?>
y este es el codigo HTML- javascript con el que creo el formulario/
Código HTML:
<html>
	<head>
	<script language="javascript" type="text/javascript">
		function add_file(id, i) {
			if (document.getElementById(id + '_' + i).innerHTML.search('uploadinputbutton') == -1) {
				var input='<input type="file" class="uploadinputbutton" name="file_' + i +'" onchange="return add_file(\'' + id + '\', ' + (i+1) + ');" /><br />';
				var span='<span id="' + id + '_' + (i+1) + '">';
				var inputbuton='<input type="button" value="Ajouter un autre" onclick="add_file(\'' + id + '\', ' + (i+1) + ');" />';
				document.getElementById(id + '_' + i).innerHTML = input + span + inputbuton + '<\/span>\n';
			}
		}
	</script>
	</head>
	<body>
		<form method="post" action="upload.php" name="UploadForm" id="UploadForm"  enctype="multipart/form-data" >
			<table border="0" cellspacing="0" cellpadding="0">
				<tr>
					<td style="vertical-align: top; width: 50%;">
						<input type="file" class="uploadinputbutton" name="file_0" onchange="add_file('file', 1);" /><br />
						<span id="file_1"><input type="button" value="Ajouter un autre" onclick="add_file('file', 1);" /></span><br />
					</td>
				</tr>
			</table>
				<input type="submit" value="Envoyer" name="envoyerfichiers" />
		</form>
	</body>
</html> 
los dos codigos se encuentran en la misma pagina.. upload.php