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.
Can someone tell me what the following code, almost directly from a tutorial fails.
I have a two files on the server to test file access VIA javascript. Both files, source.txt and target.txt, are created with total read/write access to test the script.
It errors: 'FILE' is undefined.
Thanks in advance for any input.
code:
-----------------------------------
<script language="Javascript">
// Create the source File object
source = new File("source.txt")
// If the source file opens successfully, create a target file
if (source.open("r")) {
target = new File("target.txt")
target.open("w")
// Copy the source file to the target
while (!source.eof()) {
data = File.byteToString(source.readByte())
target.write(data);
}
source.close()
}
target.close()
I don't recall where I got the script from. However, I see the exact script is there. Would you be able to make that script work (the one on the site)?
By the way, adding the:
language="Javascript 1.2"
to the simpliest script causes it not to work. For instance the following will work until the "1.2".
Oh yea, another, "by the way", I notice that I posted the original message in the wrong area. I meant to post it under Programming... If you like I can look for an followups there.
This may be a dumb question, but are you using that script on the server side? AFAIK, that script will not work in a client's browser - it has to be used as part of a server-side implementation.
(There is no "File" object in the Client-Side spec, that is what lead me to believe you were attempting to use it on the client's side.)
The script was being used on the server side.
Thanks for the input. After further studying, I learned that this seems to be some special proprietary feature of the iplanet server.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.