Monday, December 17, 2007

How to create a text file in the web server

How to create a text file in the web server

S T E P - 1

- We need to use the FileSystemObject object to get the information:

<%

Dim fSys, f

Set fSys = CreateObject("Scripting.FileSystemObject")

%>

S T E P - 2

- Now, we need to get the web server current folder.

- We can use the server.mappath(".") to get it.

- So, we can create a text file in the web server by using CreateTextFile method.

<%

Set objNewFile = objFileSys.CreateTextFile(server.mappath(".") & "\myFile.txt")

Set objNewFile = Nothing

Set objFileSys = Nothing

%>

No comments: