Det er rimeligt "nemt".
En-eller-anden-fil.php:
<form method="post" action="upload.php" enctype="multipart/form-data">
<input type="file" name="pictures[]" /><br />
<input type="file" name="pictures[]" /><br />
<input type="file" name="pictures[]" /><br />
<input type="file" name="pictures[]" /><br />
<input type="file" name="pictures[]" /><br />
<input type="submit" name="submit" value="Send" />
</form>
Upload.php:
<?php
$uploads_dir = '/pictures';
foreach ($_FILES["pictures"]["error"] as $key => $error) {
if ($error == UPLOAD_ERR_OK) {
$tmp_name = $_FILES["pictures"]["tmp_name"][$key];
$name = $_FILES["pictures"]["name"][$key];
move_uploaded_file($tmp_name, $uploads_dir."/".$name);
mysql_query("INSERT INTO pictures SET filename = '" . $name . "');
}
}
?>
Det er selvfølgelig bare et eksempel, men du kan arbejde videre ud fra dette.