Answers for "using content of a file as input"

3

js fileinput get content

//get file object
var file = document.getElementById('myFile').files[0];
if (file) {
  // create reader
  var reader = new FileReader();
  reader.readAsText(file);
  reader.onload = function(e) {
    // browser completed reading file - display it
    alert(e.target.result);                     
  };
}
Posted by: Guest on November-25-2021
0

set text of file input

<input type="button" id="loadFileXml" value="loadXml" onclick="document.getElementById('file').click();" />
<input type="file" style="display:none;" id="file" name="file"/>
Posted by: Guest on May-22-2021

Code answers related to "using content of a file as input"

Browse Popular Code Answers by Language