Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Introduction of $_ FILES array in PHP

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

This article focuses on "introduction to the $_ FILES array in PHP". Interested friends may wish to have a look at it. The method introduced in this paper is simple, fast and practical. Now let the editor to take you to learn the "introduction to the $_ FILES array in PHP"!

The PHP $_ FILES array is as follows:

$_ FILES ['myFile'] [' name'] the original name of the client file.

The MIME type of the $FILES ['myFile'] [' type'] file, which requires the browser to provide support for this information, such as "image/gif".

$_ FILES ['myFile'] [' size'] c.

The temporary file name stored on the server after the $_ FILES ['myFile'] [' tmp_name'] file is uploaded, which is generally the system default. It can be specified in the upload_tmp_dir of php.ini, but setting it with the putenv () function does not work.

$_ FILES ['myFile'] [' error'] and the error code associated with the file upload. ['error'] is added in PHP version 4.2.0. Here is its description: (they become constants 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 limit of the upload_max_filesize option in php.ini.

UPLOAD_ERR_FORM_SIZE

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 files have been uploaded.

Value: 5; upload file size is 0.

After uploading a file using the PHP $_ FILES array, it is stored in a temporary directory by default, and you must delete it from the temporary directory or move it 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.

At this point, I believe you have a deeper understanding of the "introduction to the $_ FILES array in PHP". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

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.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report