showimagepreview does not work on safari

-1

I have this script to give a preview of the image before the upload works perfectly in ie chrome and firefox except on the safari ... has anyone had problems with safari ?? if anyone can give a tip ... grace

<head>
<script type="text/javascript" src="js/jquery.js"></script>
<script type="text/javascript">
function showimagepreview(input) {
    if (input.files && input.files[0]) {
        var filerdr = new FileReader();
        filerdr.onload = function(e) {
            $('#foto').attr('src', e.target.result);
            $("#ft").fadeOut();
            $("#foto").fadeIn(1000);
            $("#label").fadeIn(1000);
        }
        filerdr.readAsDataURL(input.files[0]);
    }
}
</script>
</head>
<body>
    <form action="" method="Post" enctype="multipart/form-data"  name="form" id="form">
        <label id="label" style="display:none;">
        <div id="dft1" class="img_preview">
            <div class="img_prev">
                <img id="foto" style="display:none;"/>
            </div>
        </div></label>
        <input type="file" class="input_file" name="ft" id="ft" onchange="showimagepreview(this)"/>
    </form>
</body>
    
asked by anonymous 13.09.2014 / 20:27

1 answer

0

Try using this library, which resolves the lack of FileReader support in Safari :

link

    
13.09.2014 / 20:52