How to upload preview image before upload through JavaScript
<p>I want to preview an image before uploading it to the server. I have written a little bit code for it, but it is only being previewed in Internet Explorer, not in other browsers like Safari, Chrome, Firefox, due to some type of security reasons. Is there any solution to preview the image in these browsers?</p>

<pre><code>    &lt;body&gt;
       &lt;form name="Upload" enctype="multipart/form-data" method="post"&gt;
           Filename: &lt;INPUT type="file" id="submit"&gt;
           &lt;INPUT type="button" id="send" value="Upload"&gt;
       &lt;/form&gt;
       &lt;div 
           id="div" 
           align="center" 
           style="height: 200px;width: 500px;border-style: ridge;border-color: red"&gt;
       &lt;/div&gt;
    &lt;/body&gt;

    &lt;script type="text/javascript"&gt;
        var img_id=0
        var image = new Array()
        document.getElementById('send').onclick=function()
        {
            img_id++
            var id="imgid"+img_id
            image = document.getElementById('submit').value;
            document.getElementById('div').innerHTML="&lt;img id='"+id+"' src='"+image+"' width=500px height=200px&gt;"
        }
    &lt;/script&gt;
&lt;/html&gt;
</code></pre>
