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

Forum statistics

Threads
473,755
Messages
2,569,535
Members
45,007
Latest member
obedient dusk

Latest Threads

Top