1var input = document.getElementById("inputFile");
2var fReader = new FileReader();
3fReader.readAsDataURL(input.files[0]);
4fReader.onloadend = function(event){
5 var img = document.getElementById("yourImgTag");
6 img.src = event.target.result;
7}
1// Use
2document.getElementById("file-id").files[0].name;
3
4// instead of
5document.getElementById('file-id').value