[Solved] c#–how to set a pic in html element in webBrowser [closed]


As far as i understand you want to see your picture right after you upload it on your web page. Try this:

 <div class="form-group">
            <label for="Photo">Photo</label>
            <input type="file"
                   id="Photo"
                   name="Photo"
                   onchange="show(this)" />
        </div>

<img id="onLoad"
             src="#"
             alt="qwerty">

<script>
function show(input) {
    if (input.files && input.files[0]) {
        var reader = new FileReader();

        reader.onload = function (e) {
            $('#onLoad')
                .attr('src', e.target.result);
        };

        reader.readAsDataURL(input.files[0]);
    }
}
</script>

1

solved c#–how to set a pic in html element in webBrowser [closed]