write to existing file append

A

adamsroy

Hi I'm trying to append an already existent text file, simple enough,
but it doesn't seem to be working,
here's my code

<%@LANGUAGE="JAVASCRIPT" CODEPAGE="1252"%>

<%
var stringToWrite =
"date=12/0305atfuzionhouse&guest1=SomeName&mail1=somemail&phone1=Somephone22222";
var fso;
var file;
var ForAppending = 8;
var ForWriting = 2;

fso = new ActiveXObject("Scripting.FileSystemObject");

file =
fso_OpenTextFile(Server.mappath("guestlist.txt",ForAppending,true));
file.Write(stringToWrite);


%>
I can use the create text file method but this over writes the file
and when i use the above code i get
Wrong number of arguments or invalid property assignment
any help is appriciated
 
M

McKirahan

Hi I'm trying to append an already existent text file, simple enough,
but it doesn't seem to be working,
here's my code

<%@LANGUAGE="JAVASCRIPT" CODEPAGE="1252"%>

<%
var stringToWrite =
"date=12/0305atfuzionhouse&guest1=SomeName&mail1=somemail&phone1=Somephone22
222";
var fso;
var file;
var ForAppending = 8;
var ForWriting = 2;

fso = new ActiveXObject("Scripting.FileSystemObject");

file =
fso_OpenTextFile(Server.mappath("guestlist.txt",ForAppending,true));
file.Write(stringToWrite);


%>
I can use the create text file method but this over writes the file
and when i use the above code i get
Wrong number of arguments or invalid property assignment
any help is appriciated

You have a parenthesis in the wrong place:

Change

fso_OpenTextFile(Server.mappath("guestlist.txt",ForAppending,true));

to

fso_OpenTextFile(Server.mappath("guestlist.txt"),ForAppending,true);
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,997
Messages
2,570,240
Members
46,830
Latest member
HeleneMull

Latest Threads

Top