1
0
mirror of https://github.com/php/doc-en.git synced 2026-03-23 23:32:18 +01:00

Add type information for UPLOAD_* constants (#3950)

And remove duplicate info by using linking via the <constant> tag.
This commit is contained in:
Gina Peter Banyard
2024-11-04 15:00:01 +00:00
committed by GitHub
parent 75a5125c8b
commit 3944dc6333
2 changed files with 47 additions and 82 deletions

View File

@@ -261,79 +261,11 @@ foreach ($_FILES["pictures"]["error"] as $key => $error) {
during the file upload by PHP. In other words, the error might be
found in <varname>$_FILES['userfile']['error']</varname>.
</simpara>
<para>
<variablelist>
<varlistentry>
<term><constant>UPLOAD_ERR_OK</constant></term>
<listitem>
<para>
Value: 0; There is no error, the file uploaded with success.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><constant>UPLOAD_ERR_INI_SIZE</constant></term>
<listitem>
<para>
Value: 1; The uploaded file exceeds the
<link linkend="ini.upload-max-filesize">upload_max_filesize</link>
directive in &php.ini;.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><constant>UPLOAD_ERR_FORM_SIZE</constant></term>
<listitem>
<para>
Value: 2; The uploaded file exceeds the <emphasis>MAX_FILE_SIZE</emphasis>
directive that was specified in the HTML form.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><constant>UPLOAD_ERR_PARTIAL</constant></term>
<listitem>
<para>
Value: 3; The uploaded file was only partially uploaded.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><constant>UPLOAD_ERR_NO_FILE</constant></term>
<listitem>
<para>
Value: 4; No file was uploaded.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><constant>UPLOAD_ERR_NO_TMP_DIR</constant></term>
<listitem>
<para>
Value: 6; Missing a temporary folder.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><constant>UPLOAD_ERR_CANT_WRITE</constant></term>
<listitem>
<para>
Value: 7; Failed to write file to disk.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><constant>UPLOAD_ERR_EXTENSION</constant></term>
<listitem>
<para>
Value: 8; A PHP extension stopped the file upload. PHP does not
provide a way to ascertain which extension caused the file upload to
stop; examining the list of loaded extensions with <function>phpinfo</function> may help.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
<simpara>
The value of this error code is one of the
<constant>UPLOAD_ERR_<replaceable>*</replaceable></constant>
constants.
</simpara>
</sect1>
<sect1 xml:id="features.file-upload.common-pitfalls">

View File

@@ -420,73 +420,106 @@
</varlistentry>
</variablelist>
<variablelist role="constant_list">
<variablelist xml:id="filesystem.constants.upload" role="constant_list">
<title>PHP File Upload Constants</title>
<varlistentry xml:id="constant.upload-err-cant-write">
<term><constant>UPLOAD_ERR_CANT_WRITE</constant></term>
<term>
<constant>UPLOAD_ERR_CANT_WRITE</constant>
(<type>int</type>)
</term>
<listitem>
<para>
Failed to write file to disk.
The value of the constant is <literal>7</literal>.
</para>
</listitem>
</varlistentry>
<varlistentry xml:id="constant.upload-err-extension">
<term><constant>UPLOAD_ERR_EXTENSION</constant></term>
<term>
<constant>UPLOAD_ERR_EXTENSION</constant>
(<type>int</type>)
</term>
<listitem>
<para>
A PHP extension stopped the file upload. PHP does not
provide a way to ascertain which extension caused the file upload to
stop; examining the list of loaded extensions with <function>phpinfo</function> may help.
The value of the constant is <literal>8</literal>.
</para>
</listitem>
</varlistentry>
<varlistentry xml:id="constant.upload-err-form-size">
<term><constant>UPLOAD_ERR_FORM_SIZE</constant></term>
<term>
<constant>UPLOAD_ERR_FORM_SIZE</constant>
(<type>int</type>)
</term>
<listitem>
<para>
The uploaded file exceeds the <emphasis>MAX_FILE_SIZE</emphasis>
directive that was specified in the HTML form.
The value of the constant is <literal>2</literal>.
</para>
</listitem>
</varlistentry>
<varlistentry xml:id="constant.upload-err-ini-size">
<term><constant>UPLOAD_ERR_INI_SIZE</constant></term>
<term>
<constant>UPLOAD_ERR_INI_SIZE</constant>
(<type>int</type>)
</term>
<listitem>
<para>
The uploaded file exceeds the
<link linkend="ini.upload-max-filesize">upload_max_filesize</link>
directive in &php.ini;.
The value of the constant is <literal>1</literal>.
</para>
</listitem>
</varlistentry>
<varlistentry xml:id="constant.upload-err-no-file">
<term><constant>UPLOAD_ERR_NO_FILE</constant></term>
<term>
<constant>UPLOAD_ERR_NO_FILE</constant>
(<type>int</type>)
</term>
<listitem>
<para>
No file was uploaded.
The value of the constant is <literal>4</literal>.
</para>
</listitem>
</varlistentry>
<varlistentry xml:id="constant.upload-err-no-tmp-dir">
<term><constant>UPLOAD_ERR_NO_TMP_DIR</constant></term>
<term>
<constant>UPLOAD_ERR_NO_TMP_DIR</constant>
(<type>int</type>)
</term>
<listitem>
<para>
Missing a temporary folder.
The value of the constant is <literal>6</literal>.
</para>
</listitem>
</varlistentry>
<varlistentry xml:id="constant.upload-err-ok">
<term><constant>UPLOAD_ERR_OK</constant></term>
<term>
<constant>UPLOAD_ERR_OK</constant>
(<type>int</type>)
</term>
<listitem>
<para>
There is no error, the file uploaded with success.
The value of the constant is <literal>0</literal>.
</para>
</listitem>
</varlistentry>
<varlistentry xml:id="constant.upload-err-partial">
<term><constant>UPLOAD_ERR_PARTIAL</constant></term>
<term>
<constant>UPLOAD_ERR_PARTIAL</constant>
(<type>int</type>)
</term>
<listitem>
<para>
The uploaded file was only partially uploaded.
The value of the constant is <literal>3</literal>.
</para>
</listitem>
</varlistentry>