title: How to store photo upload in a PHP session?
body: <p>I've built this webform wizard, consisting of several PHP pages. In this several pages users can fill in the form and the data gets temporarily stored in a session and at the last page the sessions are used to store all the data in the MYSQL database. Everything works fine with the exception of the uploaded file. Here is my code:</p>
  
  <p><strong>HTML:</strong> wizard_page2</p>
  
  <pre><code>&lt;form name="registratieformulier" method="post" enctype="multipart/form-data" action="sw3.php"&gt;
  
      &lt;tr&gt;&lt;td&gt;Foto winkel uploaden: &lt;/td&gt;&lt;td&gt;&lt;input type="file" name="uploadfoto"/&gt;&lt;/td&gt;&lt;/tr&gt;&lt;br /&gt;&lt;br /&gt;
  
        &lt;tr&gt;&lt;td&gt;&lt;strong&gt;Omschrijving van winkel:&lt;/strong&gt;&lt;/td&gt;                    &lt;/tr&gt;&lt;br /&gt;
  
         &lt;tr&gt;&lt;textarea cols="50" rows="7" name="omschrijvingwinkel"&gt;&lt;/textarea&gt;&lt;/tr&gt;
         &lt;input name="pkbedrijven" value="&lt;?php echo($pkbedrijven); ?&gt;" type="hidden" /&gt;
      &lt;input type="submit" name="stuurfoto" value="Verzenden" /&gt;
  
  &lt;/form&gt;
  </code></pre>
  
  <p><strong>PHP:</strong> wizard_last_page</p>
  
  <pre><code>    $_FILES['uploadfoto']['name']       = $_SESSION["naamfoto"];
      $_FILES['uploadfoto']['tmp_name']   = $_SESSION["tijdelijk"];
  
      $bn =   $_SESSION["wn"];
  
       $target_path = "../../winkels/$bn/";
  
        $target_path = $target_path . basename( $_FILES['uploadfoto']['name']);
  
  
      move_uploaded_file($_FILES['uploadfoto']['tmp_name'], $target_path)or die("There was an error uploading the file, please try again!");
       $foto_path  = "http://mywebsite.nl/winkels/$bn/".basename($_FILES['uploadfoto']['name']);
  
  
     $omschrijving   = $_SESSION["omschrijving"];
  
     $add = "UPDATE winkelprofiel SET winkelomschrijving='$omschrijving', winkelfoto='$foto_path' WHERE fkBedrijvenID=$pkbedrijven ";
     $query_upload = mysql_query($add) or die("De winkelfoto en omschrijving konden niet worden opgeslagen");
  </code></pre>