i have the following to read a local file and display,
<html>
<head>
<script>
function readfile() {
document.getElementById('iframe').contentDocument.body.firstChild.innerHTML;
}
</script>
</head>
<body>
<iframe id='iframe' src='txt2.txt' onload='readfile()'> </iframe>
<input type="file" id="fileinput" />
</body>
</html>
but here you can see i have already given the file path as 'txt2.txt', but i don't want to give the file name beforehand, instead i want to load the file and display its contents using input type="file", how to do this without using ajax ?