Method 1: createtextfile generate file method
functionWriteToFile(FileName,FileContent)
setfso=server.createobject("scripting.filesystemobject")
setfp=fso.createtextfile(server.mappath(FileName),,True)
fp.write(FileContent)
endfunction
Method 2: ADODB.Stream file generation method
SetccObjStream=Server.CreateObject("ADODB.Stream")
WithccObjStream
.Type=2
.Mode=3
.Open
.Charset="utf-8"
.Position=ccObjStream.Size
.WriteText content to generate
.SaveToFile to generate file path and file name, 2
.Close
EndWith
CreateTextFile method
Creates a specified file and returns a TextStream object that can be used to read or write the created file.
object.CreateTextFile(filename[,overwrite[,unicode]])
parameter
object
Required option. Should be the name of the FileSystemObject or Folder object.
filename
Required option. A string expression that indicates the file to be created.
overwrite
Optional. The Boolean value indicates whether an existing file can be overwritten. If the file can be overwritten, the value is True; if the file cannot be overwritten, the value is False. If this value is omitted, the existing files cannot be overwritten.
unicode
Optional. The Boolean value indicates whether a file is created in Unicode or ASCII file format. If a file is created in Unicode file format, the value is True; if a file is created in ASCII file format, the value is False. If this section is omitted, it is assumed that the ASCII file is created.