he estado mirando por aqui y por alla, y he reutilizado este codigo:
Código PHP:
Imatge 1: <input type="file" name="archivo[]"> <br />
Imatge 2: <input type="file" name="archivo[]"> <br />
Imatge 3: <input type="file" name="archivo[]"> <br />
Imatge 4: <input type="file" name="archivo[]"> <br />
Código PHP:
$archivo = $HTTP_POST_FILES['archivo'];
$count = count($archivo);
for($i=0;$i<$count;$i++)
{
$carpeta_arxius='img';
$referencia=time();
$tipus=$archivo['type'][$i];
$foto="";
$ahora="";
switch ($tipus) // preparem el nom de la foto depenent-ne del tipus
{
case 'image/gif':
$ahora = $carpeta_arxius.'/'.$referencia.'.gif';
$foto=$referencia.".gif";
$tipus="gif";
break;
case 'image/jpeg':
$ahora = $carpeta_arxius.'/'.$referencia.'.jpeg';
$foto=$referencia.".jpeg";
$tipus="jpeg";
break;
case 'image/pjpeg':
$ahora = $carpeta_arxius.'/'.$referencia.'.jpeg';
$foto=$referencia.".jpeg";
$tipus="jpeg";
break;
case 'image/JPG':
$ahora = $carpeta_arxius.'/'.$referencia.'.jpeg';
$foto=$referencia.".jpeg";
$tipus="jpeg";
break;
default:
$error++;
break;
}
if(!empty($archivo['type'][$i]))
{
move_uploaded_file($archivo['tmp_name'][$i],$ahora);
if(empty($_POST['ordre'.$i]))$ord=1;
else $ord=$_POST['ordre'.$i];
$consulta="insert into t_foto_tecnica (id_tecnica,url_foto,ordre) values (".$_POST['tec'].",'img/".$foto."',".$ord.")";
$resultat=mysql_query($consulta);
}
}
Si alguien puede echarme una mano.
Gracias (se aceptan nuevos codigos jejejeje)