title: HTML form file upload
body: <p>I'm having difficulty trying to save a file uploaded from a form, I've checked the tutorial found on the w3schools website but I keep getting an undefined index error:</p>
  
  <p>Notice: Undefined index: userpic in C:\wamp\www\HW4\confirm.php</p>
  
  <pre><code>&lt;form action="confirm.php" method="post"&gt;
  &lt;div&gt;
  &lt;fieldset&gt;
  &lt;legend&gt;New User Signup: &lt;/legend&gt;
  &lt;label&gt; &lt;strong&gt;Name:&lt;/strong&gt; &lt;input type="text" name="name" size="16" /&gt;&lt;/label&gt;&lt;br/&gt;
  &lt;label&gt; &lt;strong&gt;Gender:&lt;/strong&gt; &lt;input type="radio" name="gender" value="M"/&gt; Male
  &lt;input type="radio" name="gender" value="F" /&gt; Female
  &lt;/label&gt;&lt;br/&gt;
  &lt;label&gt; &lt;strong&gt;Age:&lt;/strong&gt; &lt;input type="text" name="age" size="6" maxlength="2" /&gt;                         &lt;/label&gt;    &lt;br/&gt;
  &lt;label&gt; &lt;strong&gt;Personality type:&lt;/strong&gt; &lt;input type="text" name="personality"     size="6" maxlength="4" /&gt;(&lt;a href="http://www.humanmetrics.com/cgi-win/JType2.asp"&gt;Don't     know your type?&lt;/a&gt;)&lt;/label&gt;
  &lt;br/&gt;
      &lt;label&gt; &lt;strong&gt;Favorite OS:&lt;/strong&gt; &lt;select name="favos"&gt;
      &lt;option selected="selected"&gt;Windows&lt;/option&gt;
      &lt;option&gt;Mac OS X&lt;/option&gt;
      &lt;option&gt;Linux&lt;/option&gt;&lt;/select&gt;
  &lt;/label&gt;&lt;br/&gt;
  &lt;label&gt; &lt;strong&gt;Seeking age:&lt;/strong&gt; 
  &lt;input type="text" name="minage" size="6" maxlength="2" placeholder="min" /&gt; to 
  &lt;input type="text" name="maxage" size="6" maxlength="2" placeholder="max"/&gt;
  &lt;/label&gt;&lt;br/&gt;
  &lt;label&gt;&lt;strong&gt;Photo:&lt;/strong&gt;&lt;input type="file" name="userpic" id="userpic" /&gt;&lt;/label&gt;
  &lt;input type="submit" value="Sign Up" /&gt;
  &lt;/fieldset&gt;
  &lt;/div&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>and the code I'm using to try and save it to a folder called 'images':</p>
  
  <pre><code>move_uploaded_file($_FILES["userpic"]["tmp_name"],"images/".$_FILES["userpic"]["name"]);
  </code></pre>