Reputation: 1169
I want user upon clicking a button it will load the a txt file from a e.g Desktop and display the contents.
Can this be done?
I found a lot of examples for loading a file but not displaying it.
Upvotes: 0
Views: 2654
Reputation: 521
There's an excellent tutorial on html5rocks.com, 'Reading Files in JavaScript using the File APIs', that shows how to use the FileReader interface:
http://www.html5rocks.com/en/tutorials/file/dndfiles/
Upvotes: 0
Reputation: 20371
JavaScript in the browser can't access the user's file system - it would be a security issue.
Additionally, check out this SO question - the File API will allow this.
Upvotes: 2
Reputation: 21376
Try this http://codesnippets.joyent.com/posts/show/602
Upvotes: 1