move_uploaded_file not working after preview page
<p>I'm submitting a form to a preview page(form) and then a final submit.  I'm having trouble getting move_uploaded_file to work.  How do i solve this?   when i check the directory there is no file there.</p>

<p>preview page   </p>

<pre><code>      $tmpname = $_FILES['titleimage']['tmp_name'];
            $imagefile = $_FILES['titleimage']['name'];
          $filename = basename($imagefile);
           $imagename = dirname(__FILE__).'/avatar/'.$filename; 

            echo "&lt;form enctype='multipart/form-data' id='submitpreview' action='/upload' method='POST'&gt;
&lt;input type='hidden'  name='image' value='$tmpname' readonly /&gt;
    &lt;input type='hidden'  name='imagedir' value='$imagename' readonly /&gt;";
                        //other code
                echo "&lt;div id='preview-submit-button'&gt;&lt;a&gt;Submit&lt;/a&gt;&lt;/div&gt;
                &lt;/form&gt;";
</code></pre>

<p>upload page</p>

<pre><code>$image = $_POST['image'];
$directory = $_POST['imagedir'];

move_uploaded_file($image,$directory);
</code></pre>
