title: How do I implement image preview using Rails and jQuery?
body: <p>I've spent the last few days reading over different ways to implement an "Image Preview" before form submission feature on my website.</p>
  
  <p>I've used HTML5 to get this working successfully on some browsers but not on all. This seems to be such a hassle so I've decided the best way to do this would be to have the image the user selects automatically upload to a temporary folder on the server so it can be displayed back to them after.</p>
  
  <h3>Details</h3>
  
  <p>This image is part of a micropost.</p>
  
  <ul>
  <li><p>User clicks micropost text area and it expands showing them a camera
  image which they can click on to select an image.</p></li>
  <li><p>After successful selection I'll use JQuery's trigger method to
  trigger the submission of a small form that uploads the file to a
  temp folder.</p></li>
  <li><p>This will allow me to show a progress bar while the upload is taking
  place then display the image back to the user. It will work on all
  browsers.</p></li>
  <li><p>Then if the user decides the image is fine they'll continue filling
  out the micropost forms text area and click post.</p></li>
  <li><p>When post is clicked the temp image will be moved to it's permanent
  position and the path will be updated.</p></li>
  </ul>
  
  <p>I'm using carrierwave for image upload.</p>
  
  <p>In my microposts table I have an image column which holds the path of the image.</p>
  
  <p>Here is where I get slightly confused. I'll have to some how get the path of the image when the micropost post button is clicked so it can be stored in microposts table but the path will be the temp path that won't be used any more because the image would have been moved to it's permanent path.</p>
  
  <p>I'd really appreciate great info on a straight forward way of doing this. The web world would be so much different if web browsers were quite like cars (e.g. 4 wheels, steering wheel, windows, petrol, diesel).</p>