Jump to content

TextStream Object


logz
 Share

Recommended Posts

Hey, Im trying to utilize the TextStream object of ASP to create and write into a textfile based on my server.This is the code im using to create the textfile.

<%     set fs=Server.CreateObject("Scripting.FileSystemObject")     set tfile=fs.CreateTextFile("D:\WWWRoot\cyban-networks.com\www\entertainment\textfiles\content_music\news\" & request.querystring("filename") & ".txt",false)     tfile.close     set tfile=nothing     set fs=nothing%>

That code works fine. The next part of the code includes a form, in which details can be wrote and submitted to the next section of ASP, which is wrote below. In this section of code, i only want to write details into a TXT file, not create a new file.

<%     set fs=Server.CreateObject("Scripting.FileSystemObject")      set t=fs.OpenTextFile("D:\WWWRoot\cyban-networks.com\www\entertainment\textfiles\content_music\news\" & request.querystring("filename") & ".txt")           t.WriteLine("<!--filename-->" & request.querystring("filename") & ".txt")     t.WriteLine("<!--author-->" & request.querystring("author"))     t.WriteLine("<!--date-->" & request.querystring("date"))     t.WriteLine("<!--header-->" & request.querystring("header"))           t.close     set t=nothing     set fs=nothing%>

However, Whenever i execute this last peice of code, I am given the error message: Bad File ModeCan anyone give me a hand here and tell me what im doing wrong?!Cheers :)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...