daily pastebin goal
47%
SHARE
TWEET

Untitled

a guest Feb 22nd, 2019 73 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <html>
  2.   <head>
  3.     <title>reading file</title>
  4.    </head>
  5. <body>
  6.  
  7.  
  8. <input type="file" id="myFile">
  9. <hr>
  10. <!--<div style="width: 300px;height: 0px" id="output"></div>-->
  11. <textarea style="width:500px;height: 400px" id="output"></textarea>
  12.  
  13. <script>
  14. var input = document.getElementById("myFile");
  15. var output = document.getElementById("output");
  16.  
  17. input.addEventListener("change", function () {
  18.   if (this.files && this.files[0]) {
  19.     var myFile = this.files[0];
  20.     var reader = new FileReader();
  21.  
  22.     reader.addEventListener('load', function (e) {
  23.       output.textContent = e.target.result;
  24.     });
  25.  
  26.     reader.readAsBinaryString(myFile);
  27.   }
  28. });
  29. </script>
  30.   </body>
  31. </html>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top