0

So, I'm trying to make an .html file, where I can select any type of file, say .txt, or .html or .py, and have the contents of said file into a textarea on my html page. How do I go about doing this? I have no clue where to start.

Coolsugar
  • 131
  • 1
  • 2
  • 9

1 Answers1

0

var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
    if (this.readyState == 4 && this.status == 200) {
       console.log(xhttp.responseText);
    }
};
xhttp.open("GET", "you_file_path", true);
xhttp.send();

Replace you_file_path with you link

Libin Prasanth
  • 559
  • 2
  • 9