title: Uploading an image before pressing submit
body: <p>My website allows a user to upload images. I'm stuck between two situations: whether I should upload the image immediately after it's selected, or upload the image after clicking the submit button.</p>
  
  <p>I decided that uploading the image immediately makes a little more sense for my website, however, I ran into another issue.</p>
  
  <p>As it stands, I want to have each image's name being the id of the post (for example: <code>500.png</code>). However, if I upload the image <em>before</em> the user clicks submit, how would I name the image in this way (since I can't get the insert id when the user presses submit)?</p>