span>html> html lang="en"> head> meta charset="UTF-8"> title>VIEWtitle> link rel="stylesheet" href="???" type="text/css" /> head> body> div class="register"> form enctype="multipart/form-data" method="post" action="uploadprocess.php" name="myform"> table> tr>td align="center" colspan="2">font style="font-size: 40px;font-family:华文彩云;"> 文件上传 font>td>tr> tr>td>请输入用户名:td>td>input type="text" name="username" /> td>tr> tr>td>请简单介绍该文件td>td>textarea rows="10" cols="40" name="fileintro" > textarea>td>tr> tr>td>请选择上传的文件:td>td>input type="file" name="myfile" /> td>tr> tr>td>input type="submit" value="上传">td>td> td>tr> table> form> div> body> html>$username=$_POST['username']; $fileintro=$_POST['fileintro']; echo $username.$fileintro; echo ""; print_r($_FILES); echo ""; //上传大文件时,需在php.ini中修改post_max_size和upload_max_filesize参数; $user_path=$_SERVER['DOCUMENT_ROOT']."/Hanshunping/UP/".$username; $user_path=iconv("utf-8","gb2312",$user_path); if(!file_exists($user_path)){ mkdir($user_path); } $fileName=$_FILES['myfile']['name']; $fileName=iconv("utf-8","gb2312",$fileName); if(is_uploaded_file($_FILES['myfile']['tmp_name'])){ $uploaded_file=$_FILES['myfile']['tmp_name']; //避免同一用户上传的同一名字文件被覆盖; $move_to_file=$user_path."/".time().rand(1,1000). substr($fileName,strrpos($fileName,".")); if(move_uploaded_file($uploaded_file,$move_to_file)){ echo $_FILES['myfile']['name']."上传OK"; }else{ echo "上传失败"; } }else{ echo "FAILED"; } 以上就介绍了php:文件系统③,包括了方面的内容,希望对PHP教程有兴趣的朋友有所帮助。