Hi all i just want to know if we can read a file using javascript like
what we do
fp=("r","path")
like that is it possible?
No, that's not possible in a browser. Javascript runs in a sandboxed environment and doesn't have access to the file system. You might need to special plugins to be installed on the client browser in order to access his file system.
Yes, this is possible, even in some browsers.
If the browser supports the new File API, you can read any file the user gives you permission to read via an input[type=file] element. Specification | Example here on StackOverflow
This can be done on all major browsers using "ajax", more specifically the XMLHttpRequest object. It's made a lot easier by libraries like jQuery, Prototype, YUI, Closure, or any of several others.
You'll need an environment that provides file reading, such as NodeJS.
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