/    Sign up×
Community /Pin to ProfileBookmark

File is not defined error in javascript.

hi,
I have written a simple javascript code to write in a file .
here is my simple code .

1 var myFile = new File(“testfile.txt”)
2 myFile.open(“w”)
3 for(i=1;i<100;i++)
4 myFile.writeln(i)
5 myFile.close()

I am running this code on client side.

but this code is giving me a error File is not defined .
can anybody tell me

What is wrong with this script ?
or any other method to read a file and to write a file in javascript .

waiting for a reply .
Thank in advance .

-Umesh

to post a comment
JavaScript

4 Comments(s)

Copy linkTweet thisAlerts:
@A1ien51Jan 04.2006 — JavaScript does not have the ability to create files. Are you trying to use activeX?

Eric
Copy linkTweet thisAlerts:
@umesh_chandakauthorJan 04.2006 — Thanks for reply.

No i am not using activeX .And i want to do it in linux.Can you give suggestions how to do in java script .
Thanks once again
Copy linkTweet thisAlerts:
@FromU2MEJan 04.2006 — JavaScript does not have the ability to create files. Are you trying to use activeX?[/QUOTE]
Sorry mate... ?
Copy linkTweet thisAlerts:
@UltimaterJan 04.2006 — Client Side JavaScript cannot manipulate files. JScript, IE's version of JavaScript, can do such with ActiveX.

Give this thread a view:

[url=https://webdeveloper.com/forum/showthread.php?t=89153] Hey, Is There A Way Of Checking If A File Exists On The Users Computer[/url]

If you are working with ServerSide JavaScript, then that is a different story. If you don't know what Server Sider JavaScript is, don't worry about it, PHP is better to learn.
×

Success!

Help @umesh_chandak spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.27,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...