php file then upload error code

coldplay.xixi
Release: 2023-03-04 07:46:01
Original
2341 people have browsed it

php file upload error code: first mark the form in the html; then add a hidden field in the form and in front of the file; finally predefine the variable [$_FILES] array.

php file then upload error code

php file upload error code:

Note:

1. When uploading a file, the form form in the html must be marked:

enctype='multipart/form-data'
Copy after login

2. There is a saying that it must be in the form form and add a hidden field in front of the file, such as:

Copy after login

File upload error code:

1. The predefined variable$_FILESarray has 5 contents:

  • $_FILES[' userfile']['name']——The original name of the client machine file

  • $_FILES['userfile']['type']——The MIME type of the file

  • $_FILES['userfile']['size']——The size of the uploaded file, in bytes

  • $_FILES['userfile ']['tmp_name'] - the temporary file name stored on the server after the file is uploaded

  • $_FILES['userfile']['error'] - and the file Upload related error codes

2. Among them,$_FILES['userfile']['error']can have the following values and meanings:

  • 0 - No errors occurred and the file was uploaded successfully. It’s not necessarily true that a file has been uploaded. It’s possible that you can check and find that the size is 0.

  • 1 - The uploaded file exceeds the limit of the upload_max_filesize option in php.ini.

  • 2 - The size of the uploaded file exceeds the value specified by the MAX_FILE_SIZE option in the HTML form.

  • #3——Only part of the file was uploaded.

  • #4——No files were uploaded. It means that the file field of the form has no content and is an empty string.

Related learning recommendations:php programming(video)

The above is the detailed content of php file then upload error code. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!