Php file Upload must ensure that the properties of the server target folder are writable: chmod777-Rdir? Main steps: 1, according to the web page set location, self-built a folder for storing files cyupload2, modify the cyupload permissions, enter the tmp folder, chmod777cyupload-R3, refer to www. w3schools. comphpphp_file_up php file Upload
Make sure that the attribute of the target folder on the server is writeable: chmod 777-R dir.
?
Main steps:
1. create a folder cyupload for storing files based on the location set on the webpage.
2. modify the cyupload permission and enter the/tmp folder. chmod 777 cyupload-R
3, refer to the http://www.w3schools.com/php/php_file_upload.asp ??? Code to separate upload.html and upload. php
4. modify the judgment statement in upload. php as needed
5. modify the php. ini file and modify the size limit of the uploaded file.
File_uploads = on; whether to allow file upload over HTTP. ON is enabled by default.
Upload_tmp_dir; upload the file to the place where the temporary file is stored on the server. if it is not specified, the default temporary folder will be used.
Upload_max_filesize = 200 m; Wangwen business, that is, the maximum file size allowed to be uploaded. The default value is 2 MB.
Post_max_size = 200 m; the maximum value that can be received by posting a form to PHP, including all values in the form. The default value is 8 MB.
Generally, after the preceding four parameters are set, uploading the file <= 8 m is not a problem, but the network is normal.
However, if you want to upload a large file larger than 8 MB, you can only set the above four items.
Further configure the following parameters
Max_execution_time = 0;
Max_input_time = 2400; the maximum time required for receiving data on each PHP page is 60 seconds by default.
Memory_limit = 256 m; maximum memory consumed by each PHP page. the default value is 8 M.
After modifying the preceding parameters, you can upload a large volume of files as permitted by the network.
Code details: upload.html
Upload. php
0) {echo "Return Code:". $ _ FILES ["file"] ["error"]."
";} Else {echo" Upload: ". $ _ FILES [" file "] [" name "]."
"; Echo" Type: ". $ _ FILES [" file "] [" type "]."
& Quot; echo & quot; Size: & quot;. ($ _ FILES [& quot; file & quot;] [& quot; size & quot;]/1024). & quot; Kb
"; Echo" Temp file: ". $ _ FILES [" file "] [" tmp_name "]."
"; If (file_exists ("/tmp/cyupload /". $ _ FILES ["file"] ["name"]) {echo $ _ FILES ["file"] ["name"]. "already exists. ";} else {move_uploaded_file ($ _ FILES [" file "] [" tmp_name "],"/tmp/cyupload /". $ _ FILES ["file"] ["name"]); echo "Stored in :". "/tmp/cyupload /". $ _ FILES ["file"] ["name"] ;}} else {echo "Invalid file" ;}?>
?