Skip to content

Instantly share code, notes, and snippets.

@abdoulmouctard
Created May 16, 2021 15:55
Show Gist options
  • Save abdoulmouctard/8a1a0a034c8fb8ebf41ffc5739ce2eef to your computer and use it in GitHub Desktop.
Save abdoulmouctard/8a1a0a034c8fb8ebf41ffc5739ce2eef to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Culture Pro</title>
</head>
<body>
<form id="form">
<input id="input-file" type="file" placeholder="File" />
<button>Submit</button>
</form>
<script>
const inputFile = document.getElementById("input-file");
inputFile.addEventListener("change", (event) => {
const file = event.target.files[0];
if (!file) return;
const reader = new FileReader();
reader.addEventListener("load", function (e) {
let text = e.target.result;
});
reader.readAsText(file);
});
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment