: This article mainly introduces php: file system ③. if you are interested in the PHP Tutorial, refer to it. VIEW
File Upload |
Enter the user name: |
|
Brief introduction to this file |
|
Select the file to be uploaded: |
|
|
|
";
Print_r($ _ FILES); echo""; // When uploading large files, you must go to php. modify the post_max_size and upload_max_filesize parameters in ini; $ 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,1000 ).
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 ";}
The above introduces php: file system ③, including some content, and hope to be helpful to friends who are interested in PHP tutorials.