image thumbnail with file input type
<p>i needed to have a thumbnail to appear alongside the file upload button (the browse button while using file input type..i have used the code below but the issue is that the code doesnt work in chrome and safari but works fine in mozilla and ie...</p>

<p>JS:</p>

<pre><code>&lt;script type="text/javascript"&gt;
    function setImage(file) {
        if(document.all)
            document.getElementById('prevImage').src = file.value;
        else
            document.getElementById('prevImage').src = file.files.item(0).getAsDataURL();
        if(document.getElementById('prevImage').src.length &gt; 0) 
            document.getElementById('prevImage').style.display = 'block';
    }
&lt;/script&gt;
</code></pre>

<p>HTML:</p>

<pre><code>&lt;div class="uploading_block_inner"&gt;
                                &lt;div class="uploaded_img_inner"&gt;&lt;img id="prevImage" style="display:none;" width="91" height="91" /&gt;&lt;/div&gt;
                                &lt;div class="submit_button_upload"&gt;
                                    &lt;div class="upload"&gt;&lt;input type="file" id=""  name="myImage" onchange="loadname(this);" style="filter:alpha(opacity=0)" /&gt;&lt;/div&gt;
                                &lt;/div&gt;
                                &lt;div class="upload_submit_inner"&gt;&lt;input type="submit" name="" value="" /&gt;&lt;/div&gt;                             
                            &lt;/div&gt;
</code></pre>
