I'm stuck with handling File APIs in my HTML program. This is my code so far:
<html>
<script>
var file = 'C://test.txt';
var myBlob = new Blob([file], {type : "text/plain"});
var myReader = new FileReader();
myReader.addEventListener("loadend", function(e){
document.write(e.srcElement.result);
});
myReader.readAsText(myBlob);
</script>
</html>
The problem is, when I run it, the output is C://test.txt
. But I want to output the contents of my file and not my file name. I've checked that my Browser's up to date. It is also necessary that I stick to HTML and JavaScript. Please help.