title: Parsing multipart form data
body: <p>I'm trying to put together a HTML POST-ed form that has two fields--a file upload, and a text field.  Since the form has a type multipart/form-data for the file upload, I can't get at the text field through the normal PHP $_POST variable.  So how can I get at the text field in the form with PHP?</p>
  
  <p>As per requested, here's some code, basically taken directly from Andrew:</p>
  
  <pre><code>&lt;html&gt;
      &lt;body&gt;
          &lt;form action="test2.php" method="post" enctype="multipart/form-data"&gt;
              Name: &lt;input type="text" name="imageName" /&gt;
              Image: &lt;input type="file" name="image" /&gt;
              &lt;input type="submit" value="submit" /&gt;
          &lt;/form&gt;
      &lt;/body&gt;
  &lt;/html&gt;
  
  &lt;?php
    echo $_POST['imageName'];
    echo "&lt;pre&gt;";
    echo var_dump($_FILES['image']);
    echo "&lt;/pre&gt;";
  ?&gt;
  </code></pre>
  
  <p>That's the entire test file.  If I remove the enctype, I can get the POST-ed data, but not the file of course.  With the enctype as multipart/form-data, I can get the file, but nothing from the POST-ed data.</p>
  
  <p>Here's the output with the enctype:</p>
  
  <pre><code>array(5) {
    ["name"]=&gt;
    string(34) "testing.png"
    ["type"]=&gt;
    string(0) ""
    ["tmp_name"]=&gt;
    string(0) ""
    ["error"]=&gt;
    int(1)
    ["size"]=&gt;
    int(0)
  }
  </code></pre>
  
  <p>Without:</p>
  
  <pre><code>testing
  
  NULL
  </code></pre>
  
  <p>Same exact input both times.</p>