Self-built station path: File Upload $ _ file parameter type

Source: Internet
Author: User
: This article mainly introduces the path of self-built small stations: File Upload $ _ FILES parameter type. For more information about PHP tutorials, see. The $ _ FILES Super global variable is special. it is the unique two-dimensional array in the predefined Super Global array. Its function is to store various information related to the file to be uploaded, which is crucial for files uploaded to the server through PHP scripts. There are a total of five items in this function:
1. $ _ FILES ["userfile"] ["error"]
$ _ FILES ["userfile"] ["error"] the array value provides important information related to the upload attempt results.
2. $ _ FILES ["userfile"] ["name"]
$ _ FILES ["userfile"] ["name"] variable specifies the initial name of the file declared on the client machine, including the extension.
3. $ _ FILES ["userfile"] ["size"]
$ _ FILES ["userfile"] ["size"] variable specifies the size of the file uploaded from the client, in bytes.
4. $ _ FILES ["userfile"] ["tmp_name"]
$ _ FILES ["userfile"] ["tmp_name"] variable specifies the temporary name assigned to the file after being uploaded to the server. This is the name of the file stored in the temporary directory (specified by the PHP command upload_tmp_dir.
5. $ _ FILES ["userfile"] ["type"]

$ _ FILES ["userfile"] ["type"] variable specifies the mime type of the file uploaded from the client.

$ _ 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.

Common mime types can refer to this URL: http://www.w3school.com.cn/media/media_mimeref.asp

What I need to upload here is an xls file, that is: application/vnd. ms-excel.

The above describes the path of self-built small stations: File Upload $ _ FILES parameter type, including content, 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.