MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/JavaScriptTips/comments/10rname/read_the_contents_of_a_userselected_file_using/
r/JavaScriptTips • u/Low_Mammoth_9371 • Feb 02 '23
1 comment sorted by
1
Code to copy below, full YT tutorial (also on image editing) here: https://youtu.be/u2VTtAXq1iA
<input type="file" accept="text/*"> <script> const inputEl = document.querySelector('[type="file"]'); inputEl.addEventListener('change', () => { const file = inputEl.files[0]; const fr = new FileReader(); fr.readAsText(file); fr.addEventListener('load', () => { console.log(fr.result); // Hello from text file 👋 }) }); </script>
1
u/Low_Mammoth_9371 Feb 02 '23
Code to copy below, full YT tutorial (also on image editing) here: https://youtu.be/u2VTtAXq1iA