(1), in
   Label Enctype and method two properties to indicate the corresponding values. 
 
 Enctype= "Multipart/form-data"; Method= "POST"
  
 
 (2), form form to set up a hidden type of input box, where the value of name is max_file_size hidden value
  
 
 2, server-side settings:
  
 
 (1), $_files Multidimensional array: Used to store all kinds of uploaded files related to Information
  
 
 (2), File Upload and PHP configuration file settings, such as the following php.ini files in some instructions
  
 
 Instruction default Function description
  
 
 File_uploads on determines whether the PHP script on the server can accept HTTP file uploads
  
 
 Memory_limit 8M Sets the maximum amount of memory the script can allocate to prevent runaway script exclusive server Ram
  
 
 Upload_max_file 2M limits the maximum size of PHP processing uploaded files, this value must be less than Post_max_size value
  
 
 Post_max_size 8M limits the maximum value of information that can be accepted by post method
  
 
 Upload_tmp_dir NULL upload file temporary path, can be an absolute path
  
 
 
  
  
   
    
  
3, php file upload and resource instructions
  
 
 File_uploads (Boolean)
  
 
 Whether to turn on the HTTP Post file upload function
  
 
 Max_execution_time (integer)
  
 
 Maximum execution time for PHP scripts
  
 
 Memory_limit (integer) unit m
  
 
 Maximum memory for PHP scripts to run
  
 
 Upload_max_filesize (integer) unit m
  
 
 Maximum size of PHP upload file
  
 
 Upload_tmp_dir (String)
  
 
 To upload a temporary location for a file store
  
 
 Post_max_size (integer) unit m
  
 
 Maximum size of HTTP post data
  
 
 4, $_files array
  
 
 $_files[' UserFile '][size]
  
 
 Get the number of bytes to upload files
  
 
 $_files[' userfile ' [' type ']
  
 
 Gets the MIME type of the uploaded file, each of which is composed of the main type and subtype delimited by "/"
  
 
 $_files[' userfile ' [' Error ']
  
 
 Get the error code for the uploaded file, 0: No error, file upload success; 1: Upload file size exceeds the value of the upload_max_filesize option in the PHP configuration file; 2: The upload file size exceeds the value specified in the HTML form max_file_size 3: Indicates that the file is only partially uploaded; 4: Indicates that no files have been uploaded.
  
 
 $_files[' UserFile ' [' Name ']
  
 
 Gets the original name of the uploaded file, including the extension
  
 
 $_files[' UserFile ' [' Tmp_name ']
  
 
 Gets the temporary location name of the uploaded file, which is the file name that is stored in the temporary directory.
  
 
 5. File Upload function
  
 
 Is_upload_file
  
 
 Determines whether the specified file is uploaded via an HTTP Post
  
 
 BOOL Is_upload_file (String $filename)
  
 
 Move_upload_file
  
 
 Move uploaded files to a new location
  
 
 BOOL Move_upload_file (String $filename, String $destination)
  
 
 Note: After the file is uploaded, it is first stored in the temporary directory of the server, which can be used to move the uploaded file to a new location, and it can detect and ensure that the file specified by the first parameter filename is a legally uploaded file, compared to copy () and moving ().
  
 
 6, Error message description
  
 
 Upload_err_ok{value=0}
  
 
 Upload_err_ini_size{value=1}
  
 
 upload_err_form_size{value=2}
  
 
 Upload_err_partial{value=3}
  
 
 UPLOAD_ERR_NO_FILE{VALUE=4}
  
 
 UPLOAD_ERR_NO_TMP_DIR{VALUE=6}
  
 
 UPLOAD_ERR_CANT_WRITE{VALUE=7}