In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article introduces the relevant knowledge of "how to use $_ FILES in PHP and what matters needing attention". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!
The array of $_ FILES is as follows:
The original name of the $_ FILES ['myFile'] [' name'] client file
The MIME type of $_ FILES ['myFile'] [' type'] file, which requires the browser to provide support for this information, such as "image/gif"
$_ FILES ['myFile'] [' size'] the size of the uploaded file in bytes
The temporary file name stored on the server after the $_ FILES ['myFile'] [' tmp_name'] file is uploaded, which is generally the system default and can be specified in the upload_tmp_dir of php.ini, but the setting with the putenv () function does not work.
$_ FILES ['myFile'] [' error'] and the error code related to the file upload, ['error'] is added in PHP version 4.2.0, here is its description: (they become constant after PHP3.0)
UPLOAD_ERR_OK value: 0; No error occurred, and the file was uploaded successfully
UPLOAD_ERR_INI_SIZE value: 1; the uploaded file exceeds the upload_max_filesize option limit 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: 4; No file has been uploaded; value: 5; size of uploaded file is 0
Note:
1. After the file is uploaded, it is stored in the temporary directory by default, and it must be deleted from the temporary directory or moved somewhere else. If not, it will be deleted. That is, regardless of whether the upload is successful or not, the files in the temporary directory will be deleted after the script is executed. So before deleting it, use the copy () function of PHP to copy it to another location, at this point, the upload process is complete.
two。 Prior to PHP 4.1.0, the array was named $HTTP_POST_FILES, which is not an automatic global variable like $_ FILES. PHP 3 does not support the $HTTP_POST_FILES array.
3. When uploading a file with form, be sure to add the attribute content enctype= "multipart/form-data", otherwise an exception will be reported when you use $_ files [filename] to get the file information.
The copy code is as follows:
This is the end of "how to use $_ FILES in PHP and what to pay attention to". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.