title: type='file' submits as POST
body: <p>I have this html:</p>
  
  <pre><code>&lt;form method="post" action="install.php"&gt;
    &lt;input type="text" name="database_username" id="database_username"&gt;
    &lt;input type="password" id="database_password" name="database_password"&gt;
    &lt;input type="file" class="logo-field" id="logo_field" name="file"&gt;
    &lt;input type="submit" class="button success expand"&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>My PHP in <code>install.php</code>:</p>
  
  <pre><code>if ($_FILES['file']['error'] !== UPLOAD_ERR_OK){
    die("Didn't upload properly. Error: " . $_FILES['file']['error']);
  }
  
  $info = getimageSize($_FILES['file']['tmp_name']);
  
  if ($info == FALSE){
    die("Can't get the type of uploaded file.");
  }
  
  if (($info[2] !== IMAGE_GIF) &amp;&amp; ($info[2] !== IMAGE_JPEG) &amp;&amp; ($info[2] !== IMAGE_PNG)){
    die("Not a gif/jpeg/png");
  }
  </code></pre>
  
  <p>However, it isn't working (giving a blank error as per the first <code>die()</code>).</p>
  
  <p>When I <code>var_dump($_FILES)</code> I get:</p>
  
  <pre><code>array(0) { }
  </code></pre>
  
  <p>But when I do `var_dump($_POST); ?></p>
  
  <pre><code>array(3) { ["database_username"]=&gt; string(8) "username" ["database_password"]=&gt; string(8) "password" ["file"]=&gt; string(14) "image-name.jpg" }
  </code></pre>
  
  <p>It's just a normal form which a user will input their username/password and upload an ID if they want, however I'm having a really hard time trying to get the image to go onto the next page.</p>
  
  <p>I get this error when trying to access <code>$_FILES['file']</code>:</p>
  
  <pre><code>Message: Undefined index: file
  </code></pre>
  
  <p><strong>Q:</strong> Why is the image upload not working?</p>