<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = 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.common-pitfalls.php',
    1 => 'Common Pitfalls',
    2 => 'Common Pitfalls',
  ),
  'up' => 
  array (
    0 => 'features.file-upload.php',
    1 => 'Handling file uploads',
  ),
  'prev' => 
  array (
    0 => 'features.file-upload.errors.php',
    1 => 'Error Messages Explained',
  ),
  'next' => 
  array (
    0 => 'features.file-upload.multiple.php',
    1 => 'Uploading multiple files',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'en',
    'path' => 'features/file-upload.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="features.file-upload.common-pitfalls" class="sect1">
   <h2 class="title">Common Pitfalls</h2>
   <p class="simpara">
    The <code class="literal">MAX_FILE_SIZE</code> item cannot specify a file size 
    greater than the file size that has been set in the <a href="ini.core.php#ini.upload-max-filesize" class="link">upload_max_filesize</a> in
    the <var class="filename">php.ini</var> file. The default is 2 megabytes.
   </p>
   <p class="simpara">
    If a memory limit is enabled, a larger <a href="ini.core.php#ini.memory-limit" class="link">memory_limit</a> may be needed. Make
    sure you set <a href="ini.core.php#ini.memory-limit" class="link">memory_limit</a>
    large enough.
   </p>
   <p class="simpara">
    If <a href="info.configuration.php#ini.max-execution-time" class="link">max_execution_time</a>
    is set too small, script execution may be exceeded by the value. Make
    sure you set <code class="literal">max_execution_time</code> large enough.
   </p>
   <blockquote class="note"><p><strong class="note">Note</strong>: 
    <span class="simpara">
     <a href="info.configuration.php#ini.max-execution-time" class="link">max_execution_time</a> only
     affects the execution time of the script itself.  Any time spent
     on activity that happens outside the execution of the script
     such as system calls using <span class="function"><a href="function.system.php" class="function">system()</a></span>, the
     <span class="function"><a href="function.sleep.php" class="function">sleep()</a></span> function, database queries, time taken by
     the file upload process, etc. is not included when determining the maximum
     time that the script has been running.
    </span>
   </p></blockquote>
   <div class="warning"><strong class="warning">Warning</strong>
    <p class="simpara">
     <a href="info.configuration.php#ini.max-input-time" class="link">max_input_time</a> sets the maximum
     time, in seconds, the script is allowed to receive input; this includes
     file uploads.  For large or multiple files, or users on slower connections,
     the default of <code class="literal">60</code> seconds may be exceeded.
    </p>
   </div>
   <p class="simpara">
    If <a href="ini.core.php#ini.post-max-size" class="link">post_max_size</a> is set too
    small, large files cannot be uploaded.  Make sure you set
    <code class="literal">post_max_size</code> large enough.
   </p>
   <p class="simpara">
    The
    <a href="ini.core.php#ini.max-file-uploads" class="link">max_file_uploads</a> configuration
    setting controls the maximum number of files that can uploaded in one
    request. If more files are uploaded than the limit, then
    <var class="varname"><a href="reserved.variables.files.php" class="classname">$_FILES</a></var> will stop processing files once the limit is
    reached. For example, if
    <a href="ini.core.php#ini.max-file-uploads" class="link">max_file_uploads</a> is set to
    <code class="literal">10</code>, then <var class="varname"><a href="reserved.variables.files.php" class="classname">$_FILES</a></var> will never contain
    more than 10 items.
   </p>
   <p class="simpara">
    Not validating which file you operate on may mean that users can access
    sensitive information in other directories.
   </p>
   <p class="simpara">
    Due to the large amount of directory listing styles we cannot guarantee
    that files with exotic names (like containing spaces) are handled properly.
   </p>
   <p class="simpara">
    A developer may not mix normal <code class="literal">input</code> fields and file upload fields in the same
    form variable (by using an <code class="literal">input</code> name like <code class="literal">foo[]</code>).
   </p>
  </div><?php manual_footer($setup); ?>