este es el formulario
Código PHP:
<form action="file-upload2.php" method="post" enctype="multipart/form-data">
<input name="foto[]" type="file" /><br />
<input name="foto[]" type="file" /><br />
<input name="foto[]" type="file" /><br />
<input name="foto[]" type="file" /><br />
<input type="submit" value="Enviar" />
</form>
Código PHP:
<?php
$conexion = mysql_connect("localhost","root","") or die("No se pudo realizar la conexion con el servidor.");
mysql_select_db("test",$conexion) or die("No se puede seleccionar BD");
for($i=0;$i<count($foto);$i++)
{
$foto = $_FILES['foto'][$i]['tmp_name'];
$f[$i]=addslashes(fread(fopen($foto, "rb"), filesize($foto)));
$f_nombre[$i]=$_FILES['foto'][$i]['name'];
$f_peso[$i]=$_FILES['foto'][$i]['size'];
$f_tipo[$i]=$_FILES['foto'][$i]['type'];
}
//insertamos los datos en la BD.
$consulta_insertar="INSERT INTO img (id ,foto1 ,f_nombre1 ,f_peso1 ,f_tipo1 ,foto2 ,f_nombre2 ,f_peso2 ,f_tipo2 ,foto3 ,f_nombre3 ,f_peso3 ,f_tipo3 ,foto4 ,f_nombre4 ,f_peso4 ,f_tipo4) VALUES ('', '$f[0]', '$f_nombre[0]', '$f_peso[0]','$f_tipo[0]','$f[1]', '$f_nombre[1]', '$f_peso[1]','$f_tipo[1]','$f[2]', '$f_nombre[2]', '$f_peso[2]','$f_tipo[2]','$f[3]','$f_nombre[3]', '$f_peso[3]','$f_tipo[3]')";
mysql_query($consulta_insertar,$conexion) or die(mysql_error());
echo'<h2>Datos insertados</h2>';
echo'<a href="listar_imagenes.php">Ver la Galeria</a>';
?>
![triste](http://static.forosdelweb.com/fdwtheme/images/smilies/frown.png)