admin
06-04-2003, 02:48 PM
When working with files you use the built in component: FileSystemObject. This component comes packed with lots of nice methods you can use to create, delete and manipulate files and folders. Here, we'll show how to READ from a text file that has already been created.
The code below will open a text file and display the contents to the page...
<%
Set FSO = Server.CreateObject("Scripting.FileSystemObject")
Set theTextFile = FSO.OpenTextFile("c:\inetpub\wwwroot\stuff\stuff.txt")
While Not theTextFile.AtEndOfStream
Response.Write(theTextFile.ReadLine)
Wend
theTextFile.Close
Set theTextFile = Nothing
%>
The code below will open a text file and display the contents to the page...
<%
Set FSO = Server.CreateObject("Scripting.FileSystemObject")
Set theTextFile = FSO.OpenTextFile("c:\inetpub\wwwroot\stuff\stuff.txt")
While Not theTextFile.AtEndOfStream
Response.Write(theTextFile.ReadLine)
Wend
theTextFile.Close
Set theTextFile = Nothing
%>