Following javascript method reads a file and displays the contents in output element.
HTML
<input type='file' accept='text/plain' onchange='openFile(event)'><br>
<div id='output' />
Javascript
<script type="text/javascript">
        var openFile = function (event) {
            var input = event.target;
            var reader = new FileReader();
            reader.onload = function () {
                var text = reader.result;
                var node = document.getElementById('output');
                node.innerText = text;
                console.log(reader.result.substring(0, 200));
            };
            reader.readAsText(input.files[0]);
        };
    </script>
Requirement:
My requirement is to read a specific local file. For example,
openFile('test.xml');
I have tried change the method but always get error. Can someone help?
