title: How to show a preview of the uploaded image before uploading it
body: <p>I have created an html form that contact text input fields as well as file input for image uploads. I have already created the <code>submit.php</code> that handles the image file uploaded as well as other text inputs that are typed in by the users and this php file works fine. However, I have also added an option for the user to preview form in the html form page so if they want to preview the form first before submitting it, they are taken to the <code>form_preview.php</code> page that shows them the preview of the completed form along with the forms beneath this preview so they can edit it further if they want. In this preview page, I am having a problem in showing a preview of the uploaded image before uploading it.</p>
  
  <p>Here is my code and on info on what I've tried so far: In the <code>form_preview.php</code> page, I have the following:</p>
  
  <pre><code>&lt;h1&gt;Form Preview:&lt;/h1&gt;
  
  &lt;p&gt;Intro: &lt;?php echo $_POST["intro"]; ?&gt; &lt;/p&gt;
  
  &lt;p&gt;My Story: &lt;?php echo $_POST["story"]; ?&gt; &lt;/p&gt;
  
  &lt;img src="&lt;?php echo $_FILES["file"]["tmp_name"]; ?&gt;" /&gt;
  </code></pre>
  
  <p>The above shows a broken image instead of showing an image. I thought the uploaded image will be stored in a temporary folder and if I added the <code>$_FILES["file"]["tmp_name"];</code> as the image source it may show that image. Since its not showing, does it mean that this will not work? So is my only other option for this is to process the upload and store in the 'upload' folder first (similar to what I do in the <code>submit.php</code> file) and then add the link to the actual image that was added to this upload folder?</p>