Jump to content

TextStream Object

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 post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...