LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 10-15-2010, 08:37 AM   #1
bigearsbilly
Senior Member
 
Registered: Mar 2004
Location: england
Distribution: Mint, Armbian, NetBSD, Puppy, Raspbian
Posts: 3,515

Rep: Reputation: 239Reputation: 239Reputation: 239
javascript reading files?


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?
 
Old 10-15-2010, 09:02 AM   #2
tardis1
LQ Newbie
 
Registered: Sep 2010
Location: Texas
Distribution: Ubuntu Server lucid, Ubuntu Desktop maverick
Posts: 15

Rep: Reputation: 0
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.
 
Old 10-15-2010, 09:19 AM   #3
bigearsbilly
Senior Member
 
Registered: Mar 2004
Location: england
Distribution: Mint, Armbian, NetBSD, Puppy, Raspbian
Posts: 3,515

Original Poster
Rep: Reputation: 239Reputation: 239Reputation: 239
yes, well I'm developing on fedora, can't bear using windoze.
so activeX is out.
 
Old 10-17-2010, 05:16 PM   #4
devnull10
Member
 
Registered: Jan 2010
Location: Lancashire
Distribution: Slackware Stable
Posts: 572

Rep: Reputation: 120Reputation: 120
You could have a server-side script which reads the file and use AJAX to call that script.
 
Old 10-17-2010, 10:19 PM   #5
Sergei Steshenko
Senior Member
 
Registered: May 2005
Posts: 4,481

Rep: Reputation: 454Reputation: 454Reputation: 454Reputation: 454Reputation: 454
Quote:
Originally Posted by bigearsbilly View Post
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.
 
Old 10-18-2010, 09:17 AM   #6
Juako
Member
 
Registered: Mar 2010
Posts: 202

Rep: Reputation: 84
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.
 
1 members found this post helpful.
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
problem in mounting cdrom(audio files running but not reading data files) amit_usual Linux - Newbie 7 12-29-2007 05:52 AM
Reading/Wirting file/parsing xml file using javascript fakhrul Programming 1 08-14-2007 05:08 PM
copying files with javascript provkitir Programming 3 03-15-2005 12:40 PM
Reading files in C++, using *. poeta_boy Programming 4 07-08-2004 01:01 AM
Reading Files clowns119 Programming 12 09-23-2003 06:06 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 11:20 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration