ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Distribution: Ubuntu Server lucid, Ubuntu Desktop maverick
Posts: 15
Rep:
Reply to Javascript question
Javascript in its native form is not designed to interact much with files. However, there are extensions to Javascript that allow such interaction. Since you say the server is "windoze", some of the extensions are MS extensions and the use of ActiveX objects, which I am unfamiliar with.
Users could also encounter problems if they are using non-MS browsers if you choose to use extensions.
Hello people.
Can javascript read a file on the server?
Am I correct in believing it cannot?
I'm updating a web site which has loads of javascript.
Adding a new page, which implements a list of job vacancies at the firm.
I would like a csv (for example) for the HR people to write which can be dropped on the server so the page can read. So i take it this cannot be done.
double whammy, the webserver is on windoze :-(
any suggestions?
JavaScript is typically run on client side, isn't it ? And on client side in order to access something on server side there should be the case that the server makes the stuff wanted by JavaScript available as URLs - if I understand correctly.
Client-side Javascript can't directly read files in the servers, as it is, well, *client* side. That said, it is common use to make asynchronous requests to the server for resources, which may be files (among other things). One of the most common ways to do this is via the set of techniques called AJAX.
In the case of asking for a file, it boils down to js asking the server for some file via ajax, the server reading the file, and sending it in the response to javascript.
Having windows on the server, or any other OS, doesn't change the picture whatsoever. Nor does any other client-side technology (like ActiveX).
So my response is: NO javascript can't directly read files on the server. But it can ask the server to read it and hand it over.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.