I just started working on a project that will analyze the user’s text and look for patterns, word usage, etc. My first hurdle was creating a system in which the user can upload a text file and have the server read it as a string.
After a lot of piecing together research online, I think I’ve found the answer.
Start with a simple HTML form input. This form will accept a tag and, when submitted, will run the function “loadFile.” I am using ReactJS so I had to bind the function to the parent.
React requires closing slashes on the inputs because it only recognizes “complete” tags.
Now here’s where the fun happens:
That’s it! It was so satisfying once it worked. Hope this helps!