Background: (Read before you flame...)
I want a user to be able to SELECT a text file from an HTML "file input" (on their local device) and click an upload button. I do not want the file to upload directly, I want javascript to do some validation, formatting, and then display the formatted results to the user. Where the user has several options as to what they want to do depending on the results of the validation and formatting. (and yes it is validated on server side too.)
This is NOT an AJAX request, this is asking a user to select a file and then upload it, with javascript validating and formatting the file some along the way.
Question:
Is it possible to read a file (selected by the user for upload) into an HTML web page where it can be viewed by the user and parsed by Javascript or Jquery? If it is possible, how?
It must support the basic browsers Firefox, Opera, Safari, Chrome, and IE8+.
The nearest thing you'll find is the FileReader API which is currently a draft with limited browser support.
You might have to look to using a signed Java applet to get wider support (but then you start depending on people having the Java plug-in installed).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With