Php: file system ③

Source: Internet
Author: User
: 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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.