Skip to content

Commit 3944dc6

Browse files
authored
Add type information for UPLOAD_* constants (#3950)
And remove duplicate info by using linking via the <constant> tag.
1 parent 75a5125 commit 3944dc6

File tree

2 files changed

+47
-82
lines changed

2 files changed

+47
-82
lines changed

features/file-upload.xml

Lines changed: 5 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -261,79 +261,11 @@ foreach ($_FILES["pictures"]["error"] as $key => $error) {
261261
during the file upload by PHP. In other words, the error might be
262262
found in <varname>$_FILES['userfile']['error']</varname>.
263263
</simpara>
264-
<para>
265-
<variablelist>
266-
<varlistentry>
267-
<term><constant>UPLOAD_ERR_OK</constant></term>
268-
<listitem>
269-
<para>
270-
Value: 0; There is no error, the file uploaded with success.
271-
</para>
272-
</listitem>
273-
</varlistentry>
274-
<varlistentry>
275-
<term><constant>UPLOAD_ERR_INI_SIZE</constant></term>
276-
<listitem>
277-
<para>
278-
Value: 1; The uploaded file exceeds the
279-
<link linkend="ini.upload-max-filesize">upload_max_filesize</link>
280-
directive in &php.ini;.
281-
</para>
282-
</listitem>
283-
</varlistentry>
284-
<varlistentry>
285-
<term><constant>UPLOAD_ERR_FORM_SIZE</constant></term>
286-
<listitem>
287-
<para>
288-
Value: 2; The uploaded file exceeds the <emphasis>MAX_FILE_SIZE</emphasis>
289-
directive that was specified in the HTML form.
290-
</para>
291-
</listitem>
292-
</varlistentry>
293-
<varlistentry>
294-
<term><constant>UPLOAD_ERR_PARTIAL</constant></term>
295-
<listitem>
296-
<para>
297-
Value: 3; The uploaded file was only partially uploaded.
298-
</para>
299-
</listitem>
300-
</varlistentry>
301-
<varlistentry>
302-
<term><constant>UPLOAD_ERR_NO_FILE</constant></term>
303-
<listitem>
304-
<para>
305-
Value: 4; No file was uploaded.
306-
</para>
307-
</listitem>
308-
</varlistentry>
309-
<varlistentry>
310-
<term><constant>UPLOAD_ERR_NO_TMP_DIR</constant></term>
311-
<listitem>
312-
<para>
313-
Value: 6; Missing a temporary folder.
314-
</para>
315-
</listitem>
316-
</varlistentry>
317-
<varlistentry>
318-
<term><constant>UPLOAD_ERR_CANT_WRITE</constant></term>
319-
<listitem>
320-
<para>
321-
Value: 7; Failed to write file to disk.
322-
</para>
323-
</listitem>
324-
</varlistentry>
325-
<varlistentry>
326-
<term><constant>UPLOAD_ERR_EXTENSION</constant></term>
327-
<listitem>
328-
<para>
329-
Value: 8; A PHP extension stopped the file upload. PHP does not
330-
provide a way to ascertain which extension caused the file upload to
331-
stop; examining the list of loaded extensions with <function>phpinfo</function> may help.
332-
</para>
333-
</listitem>
334-
</varlistentry>
335-
</variablelist>
336-
</para>
264+
<simpara>
265+
The value of this error code is one of the
266+
<constant>UPLOAD_ERR_<replaceable>*</replaceable></constant>
267+
constants.
268+
</simpara>
337269
</sect1>
338270

339271
<sect1 xml:id="features.file-upload.common-pitfalls">

reference/filesystem/constants.xml

Lines changed: 42 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -420,73 +420,106 @@
420420
</varlistentry>
421421

422422
</variablelist>
423-
<variablelist role="constant_list">
423+
<variablelist xml:id="filesystem.constants.upload" role="constant_list">
424+
<title>PHP File Upload Constants</title>
424425
<varlistentry xml:id="constant.upload-err-cant-write">
425-
<term><constant>UPLOAD_ERR_CANT_WRITE</constant></term>
426+
<term>
427+
<constant>UPLOAD_ERR_CANT_WRITE</constant>
428+
(<type>int</type>)
429+
</term>
426430
<listitem>
427431
<para>
428432
Failed to write file to disk.
433+
The value of the constant is <literal>7</literal>.
429434
</para>
430435
</listitem>
431436
</varlistentry>
432437
<varlistentry xml:id="constant.upload-err-extension">
433-
<term><constant>UPLOAD_ERR_EXTENSION</constant></term>
438+
<term>
439+
<constant>UPLOAD_ERR_EXTENSION</constant>
440+
(<type>int</type>)
441+
</term>
434442
<listitem>
435443
<para>
436444
A PHP extension stopped the file upload. PHP does not
437445
provide a way to ascertain which extension caused the file upload to
438446
stop; examining the list of loaded extensions with <function>phpinfo</function> may help.
447+
The value of the constant is <literal>8</literal>.
439448
</para>
440449
</listitem>
441450
</varlistentry>
442451
<varlistentry xml:id="constant.upload-err-form-size">
443-
<term><constant>UPLOAD_ERR_FORM_SIZE</constant></term>
452+
<term>
453+
<constant>UPLOAD_ERR_FORM_SIZE</constant>
454+
(<type>int</type>)
455+
</term>
444456
<listitem>
445457
<para>
446458
The uploaded file exceeds the <emphasis>MAX_FILE_SIZE</emphasis>
447459
directive that was specified in the HTML form.
460+
The value of the constant is <literal>2</literal>.
448461
</para>
449462
</listitem>
450463
</varlistentry>
451464
<varlistentry xml:id="constant.upload-err-ini-size">
452-
<term><constant>UPLOAD_ERR_INI_SIZE</constant></term>
465+
<term>
466+
<constant>UPLOAD_ERR_INI_SIZE</constant>
467+
(<type>int</type>)
468+
</term>
453469
<listitem>
454470
<para>
455471
The uploaded file exceeds the
456472
<link linkend="ini.upload-max-filesize">upload_max_filesize</link>
457473
directive in &php.ini;.
474+
The value of the constant is <literal>1</literal>.
458475
</para>
459476
</listitem>
460477
</varlistentry>
461478
<varlistentry xml:id="constant.upload-err-no-file">
462-
<term><constant>UPLOAD_ERR_NO_FILE</constant></term>
479+
<term>
480+
<constant>UPLOAD_ERR_NO_FILE</constant>
481+
(<type>int</type>)
482+
</term>
463483
<listitem>
464484
<para>
465485
No file was uploaded.
486+
The value of the constant is <literal>4</literal>.
466487
</para>
467488
</listitem>
468489
</varlistentry>
469490
<varlistentry xml:id="constant.upload-err-no-tmp-dir">
470-
<term><constant>UPLOAD_ERR_NO_TMP_DIR</constant></term>
491+
<term>
492+
<constant>UPLOAD_ERR_NO_TMP_DIR</constant>
493+
(<type>int</type>)
494+
</term>
471495
<listitem>
472496
<para>
473497
Missing a temporary folder.
498+
The value of the constant is <literal>6</literal>.
474499
</para>
475500
</listitem>
476501
</varlistentry>
477502
<varlistentry xml:id="constant.upload-err-ok">
478-
<term><constant>UPLOAD_ERR_OK</constant></term>
503+
<term>
504+
<constant>UPLOAD_ERR_OK</constant>
505+
(<type>int</type>)
506+
</term>
479507
<listitem>
480508
<para>
481509
There is no error, the file uploaded with success.
510+
The value of the constant is <literal>0</literal>.
482511
</para>
483512
</listitem>
484513
</varlistentry>
485514
<varlistentry xml:id="constant.upload-err-partial">
486-
<term><constant>UPLOAD_ERR_PARTIAL</constant></term>
515+
<term>
516+
<constant>UPLOAD_ERR_PARTIAL</constant>
517+
(<type>int</type>)
518+
</term>
487519
<listitem>
488520
<para>
489521
The uploaded file was only partially uploaded.
522+
The value of the constant is <literal>3</literal>.
490523
</para>
491524
</listitem>
492525
</varlistentry>

0 commit comments

Comments
 (0)