Parsing the $ in PHP

Source: Internet
Author: User

The contents of the

$_files array are as follows:
$_files[The original name of the ' MyFile ' [' name '] client file. The MIME type of the
$_files[' myFile ' [' type '] file requires the browser to provide support for that information, such as "Image/gif". The size, in bytes, of the uploaded file of the
$_files[' myFile ' [' Size ']. The temporary file name that is stored on the server after the
$_files[' myFile ' [' tmp_name '] file is uploaded, typically the system defaults. Can be specified in the php.ini upload_tmp_dir, but the putenv () function setting does not work.
$_files[' myFile ' [' Error '] and the file upload associated error code. [' ERROR '] is added in PHP version 4.2.0.

Below is a description of it: (they are constant after PHP3.0)
UPLOAD_ERR_OK value: 0; No error occurred, file upload succeeded.
Upload_err_ini_size Value: 1; The uploaded file exceeds the value of the Upload_max_filesize option limit in php.ini.
Upload_err_form_size Value: 2; the size of the upload file exceeds the value specified by the Max_file_size option in the HTML form.
Upload_err_partial Value: 3; The file is only partially uploaded.
Upload_err_no_file Value: 4; no files are uploaded. Value: 5; The upload file size is 0.

Note:
1. After the file is uploaded, it is stored in the temporary directory by default, and it must be removed from the temporary directory or moved to another location, if not, it will be deleted. That is, whether or not the upload succeeds, the files in the temp directory will be deleted after the script is executed. So before you delete it, copy it to another location using PHP's copy () function, which completes the upload file process.

2. Before the PHP 4.1.0 version The name of the array is $HTTP _post_files, and it is not an automatic global variable like $_files. $HTTP _post_files Array is not supported in PHP 3.

3. When uploading files with form, be sure to add the property content enctype= "Multipart/form-data", otherwise use $_files[filename] Get file information will be reported abnormal.
<form enctype= "Multipart/form-data" action= "URL" method= "POST"
<input name= "myFile" type= "file"
<input type= "Submit" value= "Upload file"
</form>

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.