php上传多张图片

最简单的形式是

<form encType="multipart/form-data" action="upAll.php" method="POST">
<input name="upload[0]" type="file" /><br/>
<input name="upload[1]" type="file" /><br/>
<input type="submit" value="上传" />
</form>


------------------------------------------------------------------------------------------------------

<?php
 foreach($_FILES['upload']['name'] as $index =>$name){


//echo $name."<br/>";
$tmp = explode('.',$name); //explode 函数
    $docName = time().rand(1,1000).".".$tmp[1];
$uploadfile = "up/".$docName;
if(move_uploaded_file($_FILES['upload']['tmp_name'][$index],$uploadfile)){
echo "文件".$name."上传成功<br/>";
}else{
echo "文件".$name."上传失败<br/>";
}
 }
?>

Meet so Meet. C plusplus I-PLUS....
原文地址:https://www.cnblogs.com/iplus/p/4490072.html