Source of: /manual/en/features.file-upload.errors.php
<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/features.file-upload.inc";
$setup = array (
'home' =>
array (
0 => 'index.php',
1 => 'PHP Manual',
),
'head' =>
array (
0 => 'UTF-8',
1 => 'en',
),
'this' =>
array (
0 => 'features.file-upload.errors.php',
1 => 'Error Messages Explained',
),
'up' =>
array (
0 => 'features.file-upload.php',
1 => 'Handling file uploads',
),
'prev' =>
array (
0 => 'features.file-upload.post-method.php',
1 => 'POST method uploads',
),
'next' =>
array (
0 => 'features.file-upload.common-pitfalls.php',
1 => 'Common Pitfalls',
),
);
$setup["toc"] = $TOC;
$setup["parents"] = $PARENTS;
manual_setup($setup);
manual_header();
?>
<div id="features.file-upload.errors" class="sect1">
<h2 class="title">Error Messages Explained</h2>
<p class="simpara">
Since PHP 4.2.0, PHP returns an appropriate error code along with the
file array. The error code can be found in the
<i>error</i> segment of the file array that is created
during the file upload by PHP. In other words, the error might be
found in <var class="varname"><a href="reserved.variables.files.php" class="classname">$_FILES['userfile']['error']</a></var>.
</p>
<p class="para">
</p><dl>
<dt class="varlistentry">
<span class="term"><b><tt class="constant">UPLOAD_ERR_OK</tt></b></span>
</dt><dd class="listitem">
<p class="para">
Value: 0; There is no error, the file uploaded with success.
</p>
</dd>
<dt class="varlistentry">
<span class="term"><b><tt class="constant">UPLOAD_ERR_INI_SIZE</tt></b></span>
</dt><dd class="listitem">
<p class="para">
Value: 1; The uploaded file exceeds the
<a href="ini.core.php#ini.upload-max-filesize" class="link">upload_max_filesize</a>
directive in <var class="filename">php.ini</var>.
</p>
</dd>
<dt class="varlistentry">
<span class="term"><b><tt class="constant">UPLOAD_ERR_FORM_SIZE</tt></b></span>
</dt><dd class="listitem">
<p class="para">
Value: 2; The uploaded file exceeds the <em class="emphasis">MAX_FILE_SIZE</em>
directive that was specified in the HTML form.
</p>
</dd>
<dt class="varlistentry">
<span class="term"><b><tt class="constant">UPLOAD_ERR_PARTIAL</tt></b></span>
</dt><dd class="listitem">
<p class="para">
Value: 3; The uploaded file was only partially uploaded.
</p>
</dd>
<dt class="varlistentry">
<span class="term"><b><tt class="constant">UPLOAD_ERR_NO_FILE</tt></b></span>
</dt><dd class="listitem">
<p class="para">
Value: 4; No file was uploaded.
</p>
</dd>
<dt class="varlistentry">
<span class="term"><b><tt class="constant">UPLOAD_ERR_NO_TMP_DIR</tt></b></span>
</dt><dd class="listitem">
<p class="para">
Value: 6; Missing a temporary folder. Introduced in PHP 4.3.10 and PHP
5.0.3.
</p>
</dd>
<dt class="varlistentry">
<span class="term"><b><tt class="constant">UPLOAD_ERR_CANT_WRITE</tt></b></span>
</dt><dd class="listitem">
<p class="para">
Value: 7; Failed to write file to disk. Introduced in PHP 5.1.0.
</p>
</dd>
<dt class="varlistentry">
<span class="term"><b><tt class="constant">UPLOAD_ERR_EXTENSION</tt></b></span>
</dt><dd class="listitem">
<p class="para">
Value: 8; File upload stopped by extension. Introduced in PHP 5.2.0.
</p>
</dd>
</dl>
<p>
</p>
<blockquote><p><b class="note">Note</b>:
These became PHP constants in PHP 4.3.0.
<br />
</p></blockquote>
</div><?php manual_footer(); ?>