En
Envío de multiples ficheros lo ejemplifican bien
Código PHP:
Here is a the simple test form I needed, pieced togther from 2 or 3 posts in the documentation elsewhere.
<html>
<head>
<title>HTML Form for uploading image to server</title>
</head>
<body>
<form action="" method="post" enctype="multipart/form-data">
<p>Pictures:
<input type="file" name="pictures[]" />
<input type="file" name="pictures[]" />
<input type="file" name="pictures[]" />
<input type="submit" value="Send" />
</p>
</form>
<?php
//places files into same dir as form resides
foreach ($_FILES["pictures"]["error"] as $key => $error) {
if ($error == UPLOAD_ERR_OK) {
echo"$error_codes[$error]";
move_uploaded_file(
$_FILES["pictures"]["tmp_name"][$key],
$_FILES["pictures"]["name"][$key]
) or die("Problems with upload");
}
}
?>
</body>
</html>