多文件上传代码(自己总结)
网页1:
<form enctype="multipart/form-data" action="try1.php" method="post">
<input type="hidden" name="MAX_FILE_SIZE" value="2000000">
<input type="file" name="upfile[]" size=20><br>
<input type="file" name="upfile[]" size=20><br>
<input type="file" name="upfile[]" size=20><br>
<input type="file" name="upfile[]" size=20><br>
<input type="file" name="upfile[]" size=20><br>
<input type="file" name="upfile[]" size=20><br>
<input type=submit name="submit" value="上传文件">
</form>
网页2:
<?php
$f=$_FILES['upfile'];
$f1=$_FILES['upfile']['tmp_name'];
$f2=$_FILES['upfile']['name'];
$destdir="doc/";
for($i=0;$i<=5;$i++)
{
if($f['size'][$i]==0)
{
exit;
}else
{
move_uploaded_file($f1[$i],$destdir.$f2[$i]);
}
}
?>
- 最新评论