title: $_FILES cannot access <input type="file"> in PHP
body: <p>Please forgive if this is a silly question.
  I am trying to learn to upload an image to a website.
  The code I am using is:</p>
  
  <pre><code>&lt;?php
  
  $name = $_FILES ['file']['name'];
  $size = $_FILES ['file']['size'];
  $type = $_FILES ['file']['type'];
  $tmp_name = $_FILES ['file']['tmp_name'];
  $error = $_FILES ['file']['error'];
  
  echo $name . $type . $size;
  
  ?&gt;
  
  &lt;form action="test.php" method="POST" enctype="multipart/file-data"&gt;
  
      &lt;input type="file" name="file"&gt;
      &lt;br&gt;&lt;br&gt;
      &lt;input type="submit" name="submit" value="Submit"&gt;
  
  
  &lt;/form&gt;
  </code></pre>
  
  <p>And I'm getting the following error:</p>
  
  <p>Notice: Undefined index: file in C:\wamp\www\Learning\test.php on line ...</p>
  
  <p>I've already checked to see if file upload is enabled in php.ini, and it is.
  I already tried to nest everything inside two "if" statement, as follows:</p>
  
  <pre><code>if (isset($_FILES['file'])){
  if (!empty($_FILES['file'])){
  ....
  variables here
  ....
  echo $name . $size . $type;
  }
  }
  </code></pre>
  
  <p>But in this case nothing happens in the page, even when I do select an image from the browse button. </p>
  
  <p>Please tell me what I am doing wrong.</p>
  
  <p>Thanks in advance</p>