Solved

File Operations

Posted on 1998-02-01
10
835 Views
Last Modified: 2008-02-20
Is it possible to do file operations in JavaScript?  (i.e. open a text file, write a line, delete a line, etc.)?  Sorry for the low points, but it's ALL that I have!  :(
0
Comment
Question by:mitchell042997
  • 4
  • 3
  • 2
  • +1
10 Comments
 
LVL 6

Expert Comment

by:Holger101497
Comment Utility
well, I post a comment instead of an answer so you can save your points for other questions...
No, file operations are not possible in Javacript. Period. It's a security feature and probably better that way (it can only be done with signed scripts in Netscape 4). File manipulations are a suicidal feature for users of Internet Exploder. Personally, I would never allow any remote computer on the internet to modify anything on my hard disk (why not modify autoexec.bat to include the very handy "format c: /u <y.key" (where y.key contains a "y" (for "YES! Do destroy my computer!") and a carriage return)??!)
0
 
LVL 6

Expert Comment

by:Holger101497
Comment Utility
P.S.: In Internet Explorer, they are possible using JScript's ActiveX entensions.
0
 
LVL 2

Author Comment

by:mitchell042997
Comment Utility
I guess my question wasn't very clear.  Is it possible to do server side file i/o with JavaScript?  Or can you do anything server side with JavaScript?  I am using InterDev, and I know that VBScript can write to the server, but I am wanting to be able to do that with JavaScript.  Is this possible, or is it still a no go?
0
 
LVL 6

Expert Comment

by:tecbuilder
Comment Utility
Holger, welcome back.

mitchell, yes server-side javascript aka Live-Connect can open, close, read, and write files.  

BTW, almost every question that is here relates to client-side javascript and is what tends to be assumed if server-side javascript is not mentioned within the question.  There are many people who do not have access to the server which will ask the same type of question as you did to find out the limits of clien-side javascript.
0
 
LVL 2

Author Comment

by:mitchell042997
Comment Utility
I do not know live-connect.  What are the function names to perform server-side disk i/o?
0
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 6

Expert Comment

by:tecbuilder
Comment Utility
You first have to obtain the compiler and what ever else comes with Live-Connect aka server-side javascript from Netscape before you can use it I believe.  I don't work with server-side JavaScript, but I have investigated a few questions to learn about some of the things it can do.  And of course, I cannot find the place which told me the file I/O commands.  I've looked everywhere but the right place.
0
 
LVL 2

Author Comment

by:mitchell042997
Comment Utility
Just trash this question.  Forget it.

Thanks for your answers, guys, but I was just looking for an answer that said I could do it without having to append anything on to my system...  I guess I just assumed that one could do file i/o like they trap events, flag events, etc. in JavaScript.  Sorry for the waste of time!
0
 
LVL 6

Expert Comment

by:tecbuilder
Comment Utility
Sorry, but that is not how experts-exchange works.  I really don't mean to be rude, but I did answer your question and it is unfair that because you can't do what you want that you should just have it deleted.  I answered your question and should receive the points.
0
 
LVL 2

Author Comment

by:mitchell042997
Comment Utility
I forsee an interesting moral debate arising.  I agree, I should not be allowed to trash my question.  Therefore I am not trashing it.  However, let me ask you this?  What if the answer you have received, you believe to be incorrect?  Who is to say that your answer is the correct one?  I am reopening the question, to allow others to answer, if there is indeed a different answer to be had.  Giving points to an incorrect answer is not how Experts Exchange works.  Therefore, although your answer may very well be correct, I leave it open for now, hoping a different answer to my problem will be presented.
0
 
LVL 1

Accepted Solution

by:
twexperts earned 10 total points
Comment Utility
Take a look at this site, it tells you everything you will need to know about server side JS.

http://developer.netscape.com/library/documentation/enterprise/wrijsap/index.htm

So to answer your question, Yes, you can do disk acess on the server side, but also no, you can't do it without adding in the JavaScript runtime engine to your server.

The JavaScript itself is compiled into bytecode executables, similar to the Java Language techniques, the engine then runs these executables when requested....

Sorry that it isn't what you wanted, if you have access to perl/cgi, I'm sure you could do anything you need with that, and you probably won't need to have anything installed server side, as most ISP's include these interpreters/compilers.

Robin (twexperts)
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

In this article, we'll look how to sort an Array in JavaScript, including the more advanced techniques of sorting a collection of records either ascending or descending on two or more fields. Basic Sorting of Arrays First, let's look at the …
This article will give core knowledge of JavaScript and will head in to your first JavaScript program. I am Durvesh Naik and I am here to deal with this series of JavaScript. I will teach you JavaScript in part wise , as its quite boring to read big…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now