473,379 Members | 1,423 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,379 software developers and data experts.

Create a txt file with javascript

Fuhrer
30
Hi there,
i'm trying to create a javascript function that would create a text file so i can write some informations in it and read it later.
I'm using the "ActiveXObject("Scripting.FileSystemObject")",

function makefile(){
var fso;var thefile;

fso = new ActiveXObject("Scripting.FileSystemObject");
thefile=fso.CreateTextFile("c:\\test.txt",true);

fso.close()
}

but nothing is happening,

so please help me,
Thank u
Dec 30 '06 #1
12 22011
I am not familiar with Active X, but when I tried your code on my computer, the error said that the object doesn't support that method ( fso.close() ). The code worked fine without the fso.close() and successfully created a file named test.txt.


Hope I helped :).
Jan 1 '07 #2
Use thefile.close() instead of fso.close().
Jan 1 '07 #3
acoder
16,027 Expert Mod 8TB
Hi there,
i'm trying to create a javascript function that would create a text file so i can write some informations in it and read it later.
I'm using the "ActiveXObject("Scripting.FileSystemObject")",

function makefile(){
var fso;var thefile;

fso = new ActiveXObject("Scripting.FileSystemObject");
thefile=fso.CreateTextFile("c:\\test.txt",true);

fso.close()
}

but nothing is happening,

so please help me,
Thank u
This will probably only be supported on IE browsers. Also, allowing a web page to create files is a security hole. If you need to just remember values why not use cookies instead?
Jan 1 '07 #4
Fuhrer
30
This will probably only be supported on IE browsers. Also, allowing a web page to create files is a security hole. If you need to just remember values why not use cookies instead?



Thanks for ur advice, but im trying to make a login page that allow to save username and password, just like the " Hotmail " page where a user has 3 option to log in:
1-Save my username and password on this computer
2-Save my username on this computer
3-Always ask for my username and password

If u have an idea to help me with such page ,i will appreciate that,

Thank u
Jan 2 '07 #5
b1randon
171 Expert 100+
Thanks for ur advice, but im trying to make a login page that allow to save username and password, just like the " Hotmail " page where a user has 3 option to log in:
1-Save my username and password on this computer
2-Save my username on this computer
3-Always ask for my username and password

If u have an idea to help me with such page ,i will appreciate that,

Thank u
You should look up the use of cookies. They are designed to do exactly what you're talking about without having to be IE only and without the security crappiness.
Jan 2 '07 #6
I am trying create a ActiveXObject like myActiveXObject = new ActiveXObject("Scripting.FileSystemObject")

in asp.net 2.0 with IE7.0
but getting error like Automation server cannot create object !!!!

what's the actual problem?
Is it necessary to install any component?
I haven't install anything..

Can anybody help me?

Thank you.
Bikash
Feb 22 '07 #7
acoder
16,027 Expert Mod 8TB
I am trying create a ActiveXObject like myActiveXObject = new ActiveXObject("Scripting.FileSystemObject")

in asp.net 2.0 with IE7.0
but getting error like Automation server cannot create object !!!!

what's the actual problem?
Is it necessary to install any component?
I haven't install anything..

Can anybody help me?

Thank you.
Bikash
See this Microsoft KB article.
Feb 22 '07 #8
I am getting some error like unboxed type error when I am converting nullable Int64 variable when I am getting a null from database,it is ok when it is returning some value .
Look at the following code :--------------

Int64? Approval_Datetime = (DR["Approval_Datetime"] == DBNull.Value) ? null : (DateTime?)DR["Approval_Datetime"]; //It is O.K.

Int64? Approved_By_Admin_Id = (DR["Approved_By_Admin_Id"] == DBNull.Value) ? null : (Int64)(DR["Approved_By_Admin_Id"]); //here I am getting error like unboxed type when I am getting null value from database

How will I be able to overcome this ..
Can anybody help me?
Feb 23 '07 #9
See this Microsoft KB article.
Thanks to acoder.
Feb 23 '07 #10
acoder
16,027 Expert Mod 8TB
Thanks to acoder.
No problem. You're welcome.
Feb 23 '07 #11
Hello,
I am trying to record when someone signs and/or agrees to an online agreement. I figured this would be be done by creating a .txt file containing the information relevant to every unique signature instance, but after reading the above statements, it seems as though creating files is a major security compliance issue; but is it really an issue even if the file creation is all happening on the server side?

Does anyone know the standard for recording such information?

Thank you all for your time and consideration,

Peace and Love,
Mikeumus
Nov 10 '08 #12
acoder
16,027 Expert Mod 8TB
Hello Mikeumus, welcome to Bytes!

The above statements were for files created locally, not on the server. Instead of text files, you should look into storing this information in a database.
Nov 10 '08 #13

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Bnob | last post by:
It is possible to create a file in local user-machine? With this code in code-behind: fs = New System.IO.FileStream(lFileCSV, System.IO.FileMode.Create, System.IO.FileAccess.Write) The file...
1
by: Victor | last post by:
Hi, We have following setup here Web Server (Win2000) and FTP Server (Win 2000) We have ASP.NET application which runs on Web Server and writes file(s) onto FTP Server. We created asp.net...
11
by: TJM | last post by:
Hi, A Javascript error is generated when the user types a few character in an INPUT TYPE=FILE and hits a submit button. The form does not post. Is there a solution to this problem? Thanks TJM
1
by: j7o0s5 | last post by:
How to create file help chm?
2
by: SteMc | last post by:
Hi, I'm trying to create a text file on an asp page but am having loads of trouble. At the minute what happens is this - I have a form with a textarea. When the form posts, the action is to run...
1
by: philmaz | last post by:
What I am trying to do is create a form that people can use to enter their email address to sign up for a mailing list. Once they enter their email address, I want the script to open up a txt file...
1
by: colleen1980 | last post by:
Hi: Can any one please tell me how to i create a button which open a file window from where i select any file and then it pass the file data into the list box. Basically in this file i have only 6...
0
Kosal
by: Kosal | last post by:
Hi I have problem with vb.net I want to create file setup or exe file for run on Client Computer that no need to install vb.net 2005 but I never do so I don't know what can i do? Please help...
5
by: plsHelpMe | last post by:
How to create dynamic javascript arrays using dojo toolkits Hello frens, I am in a big trouble. My objective is: I am having some categories shown by differnent radio buttons, on the click of...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.