<form action="" method="post" enctype="multipart/form-data">
<p>Three Files:
<input type="file" name="myfile[]" />
<input type="file" name="myfile[]" />
<input type="file" name="myfile[]" />
<input type="submit" value="Send" />
</p>
</form>
<?php
foreach ($_FILES["myfile"]["error"] as $key => $error) {
if ($error == UPLOAD_ERR_OK) {
$tmp_name = $_FILES["myfile"]["tmp_name"][$key];
$name = $_FILES["myfile"]["name"][$key];
move_uploaded_file($tmp_name, "data/$name");
}
}
?>
<p>Three Files:
<input type="file" name="myfile[]" />
<input type="file" name="myfile[]" />
<input type="file" name="myfile[]" />
<input type="submit" value="Send" />
</p>
</form>
<?php
foreach ($_FILES["myfile"]["error"] as $key => $error) {
if ($error == UPLOAD_ERR_OK) {
$tmp_name = $_FILES["myfile"]["tmp_name"][$key];
$name = $_FILES["myfile"]["name"][$key];
move_uploaded_file($tmp_name, "data/$name");
}
}
?>
No comments:
Post a Comment