I want to convert a txt file, which i have uploaded in a form, into string in javascript.
text in my text file is "my name is x".
Now i want to store the text of the file in javascript as string.
Is there any basic function? looking for a easy solution
**note: do not want to use node.js
Question posted in Javascript
A very good W3school tutorial can be found here.
A very good W3school tutorial can be found here.
3
Answers
Yes, you can easily achieve this using the FileReader API in JavaScript. Here’s a simple example to read the contents of a .txt file and store it as a string:
HTML and JavaScript Code
Simplest way!