Alright, so here's my little problem. I am trying to read a file directly from the script in JavaScript, but I have no idea how.
In order to get my file in a variable, I use this:
  function readSingleFile(e) {
    var file = e.target.files[0]; 
    if (!file) 
      return; 
    var reader = new FileReader();
    reader.onload = function(e) {
    var contents = e.target.result; 
    };
    reader.readAsText(file);}
    document.getElementById('file-input')
    .addEventListener('change', readSingleFile, false);
with this HTML:
<input type="file" id="file-input" />
The main idea is, how do I choose the path of 'file' variable directly in script? Thank you so much!
 
     
    