1
Here is a simple example of reading file using javascript, more info on links
+
+
+
Posted on 7:40 AM by Softminer and filed under
HTML,
JavaScript
Here is a simple example of reading file using javascript, more info on links
+
+
+
<input type="file" id="fileinput" /> <script type="text/javascript"> function readSingleFile(evt) { //Retrieve the first (and only!) File from the FileList object var f = evt.target.files[0]; if (f) { var r = new FileReader(); r.onload = function(e) { var contents = e.target.result; alert( "Got the file.n" +"name: " + f.name + "n" +"type: " + f.type + "n" +"size: " + f.size + " bytesn" + "starts with: " + contents.substr(1, contents.indexOf("n")) ); } r.readAsText(f); } else { alert("Failed to load file"); } } document.getElementById('fileinput').addEventListener('change', readSingleFile, false); </script>
Informative blog .. Thnq you for sharing..
Selenium training | Selenium training in chennai
Post a Comment