Click here to Skip to main content
15,885,078 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
HTML
<html>
    <head>
   

<input type="file" id="fileinput" />
<script type="text/javascript">
  function readSingleFile(evt) {
   var reader = new FileReader();
reader.onload = function(event) {
    var contents = event.target.result;
    console.log("File contents: " + contents);
};

reader.onerror = function(event) {
    console.error("File could not be read! Code " + event.target.error.code);
};

reader.readAsText(file);
</script>

    </head>
    <body>
    <input type='file' accept='text/plain' onchange='readSingleFile(evt)'><br>
    <div id="output">
    ...
    </div>
    </body>
    </html></br>
Posted
Updated 24-Jun-15 2:51am
v2

1 solution

Code samples for reading files can be found here

http://www.html5rocks.com/en/tutorials/file/dndfiles/[^]

Needs a browser that supports the relevant html5 aspects though.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900