<HTML ><HEAD ><TITLE >Error Messages Explained</TITLE ><META NAME="GENERATOR" CONTENT="Modular DocBook HTML Stylesheet Version 1.7"><LINK REL="HOME" TITLE="PHP Manual" HREF="index.html"><LINK REL="UP" TITLE="Handling file uploads" HREF="features.file-upload.html"><LINK REL="PREVIOUS" TITLE="Handling file uploads" HREF="features.file-upload.html"><LINK REL="NEXT" TITLE="Common Pitfalls" HREF="features.file-upload.common-pitfalls.html"><META HTTP-EQUIV="Content-type" CONTENT="text/html; charset=ISO-8859-1"></HEAD ><BODY CLASS="sect1" BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#840084" ALINK="#0000FF" ><DIV CLASS="NAVHEADER" ><TABLE SUMMARY="Header navigation table" WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TH COLSPAN="3" ALIGN="center" >PHP Manual</TH ></TR ><TR ><TD WIDTH="10%" ALIGN="left" VALIGN="bottom" ><A HREF="features.file-upload.html" ACCESSKEY="P" >Prev</A ></TD ><TD WIDTH="80%" ALIGN="center" VALIGN="bottom" >Chapter 18. Handling file uploads</TD ><TD WIDTH="10%" ALIGN="right" VALIGN="bottom" ><A HREF="features.file-upload.common-pitfalls.html" ACCESSKEY="N" >Next</A ></TD ></TR ></TABLE ><HR ALIGN="LEFT" WIDTH="100%"></DIV ><DIV CLASS="sect1" ><H1 CLASS="sect1" ><A NAME="features.file-upload.errors" ></A >Error Messages Explained</H1 ><P > Since PHP 4.2.0, PHP returns an appropriate error code along with the file array. The error code can be found in the <SPAN CLASS="emphasis" ><I CLASS="emphasis" >['error']</I ></SPAN > segment of the file array that is created during the file upload by PHP. In otherwords, the error might be found in <TT CLASS="varname" >$_FILES['userfile']['error']</TT >. </P ><P > <P ></P ><DIV CLASS="variablelist" ><DL ><DT ><TT CLASS="varname" >UPLOAD_ERR_OK</TT ></DT ><DD ><P > Value: 0; There is no error, the file uploaded with success. </P ></DD ><DT ><TT CLASS="varname" >UPLOAD_ERR_INI_SIZE</TT ></DT ><DD ><P > Value: 1; The uploaded file exceeds the <A HREF="configuration.directives.html#ini.upload-max-filesize" >upload_max_filesize</A > directive in <TT CLASS="filename" >php.ini</TT >. </P ></DD ><DT ><TT CLASS="varname" >UPLOAD_ERR_FORM_SIZE</TT ></DT ><DD ><P > Value: 2; The uploaded file exceeds the <SPAN CLASS="emphasis" ><I CLASS="emphasis" >MAX_FILE_SIZE</I ></SPAN > directive that was specified in the html form. </P ></DD ><DT ><TT CLASS="varname" >UPLOAD_ERR_PARTIAL</TT ></DT ><DD ><P > Value: 3; The uploaded file was only partially uploaded. </P ></DD ><DT ><TT CLASS="varname" >UPLOAD_ERR_NO_FILE</TT ></DT ><DD ><P > Value: 4; No file was uploaded. </P ></DD ></DL ></DIV > </P ><DIV CLASS="note" ><BLOCKQUOTE CLASS="note" ><P ><B >Note: </B > These became PHP constants in PHP 4.3.0 </P ></BLOCKQUOTE ></DIV ></DIV ><DIV CLASS="NAVFOOTER" ><HR ALIGN="LEFT" WIDTH="100%"><TABLE SUMMARY="Footer navigation table" WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" ><A HREF="features.file-upload.html" ACCESSKEY="P" >Prev</A ></TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="index.html" ACCESSKEY="H" >Home</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" ><A HREF="features.file-upload.common-pitfalls.html" ACCESSKEY="N" >Next</A ></TD ></TR ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" >Handling file uploads</TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="features.file-upload.html" ACCESSKEY="U" >Up</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" >Common Pitfalls</TD ></TR ></TABLE ></DIV ></BODY ></HTML >