Image Preview before submit doesn't work in IE and Safari
===

I'm currently trying to make an image preview on the client side of selected image, before the user clicks on a submit button.

I've found this approach here in the forum:

    function selectedPhotoText(input) {
        if (input.files && input.files[0]) {
            var reader = new FileReader();
    
            reader.onload = function (e) {
                $('#imagePreview')
                            .attr('src', e.target.result)
                            .width(240)
                            .height(149);
            };
    
            reader.readAsDataURL(input.files[0]);
        }
        else {
            $('#imagePreview').attr('src', "../../Images/blqblq.jpg");
        }
    }

    <img id="imagePreview" class="img-border" src="../../Images/blqblq.jpg" alt="Selected Image"/>

and the file upload control:

    <asp:FileUpload ID="uploadPhotoDialog" onchange="selectedPhotoText(this)" runat="server"/>

This approach works fine in Chrome, Firefox and Opera. Is there any workarounds for IE and Safari?

Thanks in advance!