Html>< HTML lang= "en">< Head> < Meta charset= "UTF-8"> < title> VIEW Title> < 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: + px;
font-family: Chinese Choi Wan; "> File Upload Font> Td> Tr> < TR>< TD> Please enter user name: Td>< TD>< input type= "Text" name= "username"/> Td> Tr> < TR>< TD> Please briefly describe the file Td>< TD>< textarea rows= "Ten" cols= "Max" name= "Fileintro"> TextArea> Td> Tr> < TR>< TD> Please select the uploaded file: Td>< TD>< input type= "File" name= "MyFile"/> Td> Tr> < TR>< TD>< input type= "Submit" value= " Upload "> Td>< TD> Td> Tr> Table> Form> Div> Body> Html> $username=$_post[' username '); $fileintro=$_post[' Fileintro ']; echo $username. $fileintro; Echo "
"; Print_r ($_files); "
"; // when uploading large files, you need to php.ini Modified in post_max_size And upload_max_filesize Parameters$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 ']; // Avoid overwriting the same name file uploaded by the same user; $move _to_file = $user _path . "/" .
Time () .
Rand ( 1 , + ) .
substr ($fileName,
strrpos ($fileName, "." )); if (
move_uploaded_file ($uploaded _file, $move _to_file)) { echo $_files[ ' myfile ' [ ' name ' ] . " upload ok ;} Else { echo ' upload failed " ;}} Else { echo "FAILED" ;}
above introduces PHP: File system ③, including aspects of the content, I hope that the PHP tutorial interested in a friend helpful.