Image Uploading Using a Form
<p>I have been having problems with users uploading their images using this registration form:</p>

<pre><code>&lt;?php
errors = array();
$missing = array();
// check if the form has been submitted
if (isset($_POST{'submit'}) &amp;&amp; !empty($_FILES)){
    require_once('./classes/Ps2/Upload.php');
 try {
    $upload = new Ps2_Upload('my address');
    $upload-&gt;move();
    $messages = $upload-&gt;getMessages();
  }catch (Exception $e) {
    echo $e-&gt;getMessage();
  }

   $tmp_name = $_FILES['image']['tmp_name'];
   $type = $_FILES['image']['type'];
   $name = $_FILES['image']['name'];
  $size = $_FILES['image']['size'];
   $names = $_POST['names'];
   $number = $_POST['number'];
   $email = $_POST['email'];
   $seminar = $_POST['seminar'];
   $address = $_POST['address'];

$response = recaptcha_check_answer($private_key, $_SERVER['REMOTE_ADDR'],       $_POST['recaptcha_challenge_field'], $_POST['recaptcha_response_field']);
if (!$response-&gt;is_valid) {
$errors['recaptcha'] = true;
}
&lt;?
</code></pre>

<p>And here is the form (at least the part that effects the image uploading):</p>

<pre><code>&lt;form id="register" name="register" method="post" enctype="multipart/form-data" action=""&gt;
  &lt;p&gt;
  &lt;fieldset&gt;&lt;legend class="caption"&gt;Registration Details&lt;/legend&gt;
    &lt;p&gt;
      &lt;label for="image"&gt;Upload image photograph:
      &lt;?php if ($missing &amp;&amp; in_array('image', $missing)) { ?&gt;
&lt;span class="warning"&gt;Please pick your passport&lt;/span&gt;
&lt;?php } ?&gt;
      &lt;/label&gt;
    &lt;input type="hidden" name="MAX_FILE_SIZE" value="&lt;?php echo $max; ?&gt;"&gt;
    &lt;input name="image" id="image" type="file" value="image" tabindex="1"&gt;
      &lt;/p&gt;
</code></pre>
