title: Displaying An Image uploaded via a web form without storing in a folder or database
body: <p>I have a project that requires a site visitor to fill form part of which is file upload. I intend the client to be able to view the picture once the button is clicked; the data is not stored in any folder or database for now; I just want a page to load the form data. My code is not working: when I click the button a dialog box pops up asking me what I want to do with the php file. Options iclude: open with firefox, save etc. Pls, where did I err?
  Here's the processphoto_form.php</p>
  
  <pre><code>&lt;?php
  if(isset($_FILES['userFoto']['name']) &amp;&amp; $_FILES['size']&lt;=1000000){
  $tempName = $_FILES['userFoto']['temp_name'];
  $fhand = fopen($tempName, 'r');
  $userFoto = fread($fhand, filesize($tempName));
  $userFoto = addslashes($userFoto);
  fclose($fhand);
  $user = $_POST['user'];
  header('Content-type:$userFoto/JPEG');
  echo"&lt;img scr = '$userFoto' height ='100' width = '100'/&gt;"."&lt;br/&gt;";
  cho$user;
  }
  
  ?&gt;
  </code></pre>
  
  <p>HTML</p>
  
  <pre><code>&lt;form enctype = 'multipart/form-data' method ='post' action ='processphoto_form.php'&gt;
  &lt;table&gt;
  &lt;tr&gt;&lt;td&gt;Name&lt;/td&gt;&lt;td&gt;&lt;input type = 'text' name = 'user'/&gt;&lt;/td&gt;&lt;/tr&gt;
  &lt;tr&gt;&lt;td&gt;Foto&lt;/td&gt;&lt;td&gt;&lt;input type = 'file' name = 'userFoto'/&gt;&lt;/td&gt;&lt;/tr&gt;
  &lt;tr&gt;&lt;td colspan ='2' &gt;&lt;input type = 'submit' value = 'VIEW DATA'/&gt;&lt;/td&gt;&lt;/tr&gt;
  &lt;/table&gt;
  &lt;/form&gt;
  </code></pre>