<HTML ><HEAD ><TITLE >Common Pitfalls</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="Error Messages Explained" HREF="features.file-upload.errors.html"><LINK REL="NEXT" TITLE="Uploading multiple files" HREF="features.file-upload.multiple.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.errors.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.multiple.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.common-pitfalls" ></A >Common Pitfalls</H1 ><P > The <TT CLASS="literal" >MAX_FILE_SIZE</TT > item cannot specify a file size greater than the file size that has been set in the <A HREF="configuration.directives.html#ini.upload-max-filesize" >upload_max_filesize</A > ini-setting. The default is 2 Megabytes. </P ><P > If memory limit is enabled, larger <A HREF="configuration.directives.html#ini.memory-limit" >memory_limit</A > may be needed. Make sure to set <A HREF="configuration.directives.html#ini.memory-limit" >memory_limit</A > large enough. </P ><P > If <A HREF="ref.info.html#ini.max-execution-time" >max_execution_time</A > is set too small, script execution may be exceeded the value. Make sure to set <TT CLASS="literal" >max_execution_time</TT > large enough. </P ><P > If <A HREF="configuration.directives.html#ini.post-max-size" >post_max_size</A > set too small, large files cannot be uploaded. Make sure to set <TT CLASS="literal" >post_max_size</TT > large enough. </P ><P > Not validating which file you operate on may mean that users can access sensitive information in other directories. </P ><P > Please note that the CERN httpd seems to strip off everything starting at the first whitespace in the content-type mime header it gets from the client. As long as this is the case, CERN httpd will not support the file upload feature. </P ><P > Due to the large amount of directory listing styles we cannot guarantee that files with exotic names (like containing spaces) are handled properly. </P ></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.errors.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.multiple.html" ACCESSKEY="N" >Next</A ></TD ></TR ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" >Error Messages Explained</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" >Uploading multiple files</TD ></TR ></TABLE ></DIV ></BODY ></HTML >