title: Simple PHP for File upload form not working?
body: <p>i am new to this one and in a learning phase. i created a form like below,</p>
  
  <pre><code>&lt;html&gt;
  &lt;body&gt;    
  &lt;form enctype="multipart/form-data" action="/cgi-bin/FileUpload.php" method="POST"&gt;
  &lt;label for="file"&gt;Filename:&lt;/label&gt;
  &lt;input type="file" name="ufile"/&gt;
  &lt;br /&gt;
  &lt;input type="submit" name="submit" value="Submit" /&gt;
  &lt;/form&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>and my php script looks like,</p>
  
  <pre><code>    #!/usr/bin/php
  &lt;?
  header("Content-type:text/html");
  echo "\n";
  if (isset($HTTP_POST_VARS['submit'])){
      echo "HTTP_POST_VARS['submit'] is set" . "&lt;br /&gt;";
  }
  
  if (empty($_POST)) {
      echo "Empty POST !" . "&lt;br /&gt;";
  }
  if(isset($_POST['type'])){
      echo "POST['type'] is set to " . $_POST['type'] . "&lt;br /&gt;";
  }
  
  if (isset($_SERVER['REQUEST_METHOD'])){
      echo "_SERVER['REQUEST_METHOD'] is set and REQUEST_METHOD = " . $_SERVER['REQUEST_METHOD'] . "&lt;br /&gt;";
  }
  
  if (empty($_FILES)){
      echo "_FILES is empty ! " . "&lt;br /&gt; &lt;br /&gt;";
  }
  </code></pre>
  
  <p>the putput looks like,</p>
  
  <p>Empty POST !
  _SERVER['REQUEST_METHOD'] is set and REQUEST_METHOD = POST
  _FILES is empty ! </p>
  
  <p>the related items in php.ini is like below,</p>
  
  <pre><code>;;;;;;;;;;;;;;;;
  ; File Uploads ;
  ;;;;;;;;;;;;;;;;
  
  ; Whether to allow HTTP file uploads.
  ; http://php.net/file-uploads
  file_uploads = On
  
  ; Temporary directory for HTTP uploaded files (will use system default if not
  ; specified).
  ; http://php.net/upload-tmp-dir
  upload_tmp_dir = /tmp
  
  ; Maximum allowed size for uploaded files.
  ; http://php.net/upload-max-filesize
  upload_max_filesize = 2M
  
  ; Maximum number of files that can be uploaded via a single request
  max_file_uploads = 20
  
  ; Maximum size of POST data that PHP will accept.
  ; http://php.net/post-max-size
  post_max_size = 10M
  </code></pre>
  
  <p>now, why the _POST and _FILES are getting empty ?</p>