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?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Firstly I think its not a good idea to read a file locally with JavaScript. I recommend first upload it to the server and then perform the reading.
Having said that it is possible, but you restricted by what you can do.
Im assuming its a local file on the user machine, otherwise AJAX would achieve this for a server read.
It might be possible through
Windows Script Host Object Model(WScript.Shell) and
when granted Prompt or Enable access
to ActiveX the browser has elevated
privileges (Enable through Tools >
Internet Options > Security > Custom
Level … > Set Active X settings to
prompt). If this is still to difficult, user could download something thats installed and then does the reading through Shell Scripting! Disclaimer: Note I do not recommend this approach. Its not active for a reason and its so DIRTY (I feel dirty)!
Cookies might also be worth considering. If you can store the information in a cookie the JavaScript would be able to read, write and update it.
Found this code from http://www.quirksmode.org/js/cookies.html scroll right to the bottom for the
example.
}