Describe the content of the PHP $ _ FILES array in detail. For the first contact with the PHP $ _ FILES array, the content is as follows: $ _ FILES [myFile] [name] The original name of the client file. $ _ FILES [myFile] [type] indicates the MIME type of the file, which must be provided by the browser for initial contact.The PHP $ _ FILES array contains the following content:
$ _ FILES ['myfile'] ['name'] original name of the client file.
$ _ FILES ['myfile'] ['type'] indicates the MIME type of the file, which must be supported by the browser, for example, "image/gif ".
$ _ FILES ['myfile'] ['size'] c.
$ _ FILES ['myfile'] ['tmp _ name'] temporary file name stored on the server after the file is uploaded, which is generally the default file name. It can be specified in upload_tmp_dir of php. ini, but the putenv () function setting does not work.
$ _ FILES ['myfile'] ['error'] error code related to the file upload. ['Error'] is added in PHP 4.2.0. The following is its description: (they become constants after PHP3.0)
UPLOAD_ERR_ OK
Value: 0. If no error occurs, the file is uploaded successfully.
UPLOAD_ERR_INI_SIZE
Value: 1; the uploaded file exceeds the limit of the upload_max_filesize option in php. ini.
UPLOAD_ERR_FORM_SIZE
Value: 2; the size of the uploaded file exceeds the value specified by the MAX_FILE_SIZE option in the HTML form.
UPLOAD_ERR_PARTIAL
Value: 3; only part of the file is uploaded.
UPLOAD_ERR_NO_FILE
Value: 4; no file is uploaded.
Value: 5; the size of the uploaded file is 0.
After a file is uploaded using the PHP $ _ FILES array, it is stored in a temporary directory by default. in this case, you must delete it from the temporary directory or move it to another place, will be deleted. That is, no matter whether the upload is successful or not, the files in the temporary directory will be deleted after the script is executed. Therefore, you must copy the file to another location using the copy () function of PHP before deleting the file. in this case, the file upload process is completed.
The following figure shows the contents of the optional PHP $ _ FILES array: $ _ FILES ['myfile'] ['name'] original name of the client file. $ _ FILES ['myfile'] ['type'] indicates the MIME type of the file, which must be provided by the browser...