<Solved>Send Message from Page Code to HTML (Image & Database)

Would this work to pass data from an upload button to an iframe in order to render an image preview before a form is submitted?