codetoad.com
  ASP Shopping CartForum & BBS
  - all for $20 from CodeToad Plus!
  
  Home || ASP | ASP.Net | C++/C# | DHTML | HTML | Java | Javascript | Perl | VB | XML || CodeToad Plus! || Forums || RAM 
Search Site:



Home » ASP » Article

ASP CreateTextFile

Article by: Jeff Anderson (9/2/2006)
Bookmark us now! Add to Favourites
Email a friend!Tell a friend
Summary: An explanation of the CreateTextFile Method, part of the ASP FileSystemObject
Viewed: 247045 times Rating (7 votes): 
 4 out of 5
 Rate this Article  Read Comments  Post Comments

ASP CreateTextFile



The CreateTextFile method of the FileSystemObject is used, as its name implies, to create a text file in a given folder on the server. It has a filename parameter (required ), an optional overwrite parameter and an optional unicode parameter, so the syntax is:

FileSystemObject.CreateTextFile(filename[,overwrite[,unicode]])

overwrite is a Boolean - so set it to true if you want to allow the object to overwrite the file. Set it to false if you don't

unicode is also Boolean - set it to true if to indicate that the file is in Unicode. Omit this variable, or set it to false if you want to create a standard ASCII file.

Here are two examples of using the createtextfile method. First at its most straightforward:

Select All Code


If you have a virtual server, or a deeper file structure you may want to use Request.ServerVariables("Appl_Physical_path") which finds the root folder for the current website application (for example, on codetoad.com this might be "C:/my_domains/codetoad/" )

The code then would be

Select All Code







CodeToad Experts

Can't find the answer?
Our Site experts are answering questions for free in the CodeToad forums
Rate this article:     Poor Excellent
View highlighted Comments
User Comments on 'ASP CreateTextFile'
RELATED ARTICLES
ASP FilesystemObject
by Jeff Anderson
An introduction to the Filesystemobject
ASP GetTempName
by Jeff Anderson
Use the GetTempName method to create a randomly generated temporary file on the server.
ASP OpenTextFile
by Jeff Anderson
An introduction to the OpenTextFile Method of the FileSystemObject
ASP FileExists
by Jeff Anderson
An introduction to the FileExistsMethod of the FileSystemObject
ASP CreateTextFile
by Jeff Anderson
An explanation of the CreateTextFile Method, part of the ASP FileSystemObject
ASP GetFile
by Jeff Anderson
An introduction to the GetFile Method of the FileSystemObject
ASP CreateFolder
by Jeff Anderson
Using the CreateFolder method of the filesystemobject to create a folder on the server
ASP FolderExists
by Jeff Anderson
An introduction to the FolderExistsMethod of the FileSystemObject








Recent Forum Threads
• Global.Mapper.v15.2.3.b060614
• Geometric_Glovius_Pro_v3.6.1
• VERO.SurfCAM.v2014
• Schlumberger.Petrel.V2013.2
• Petrel.V2013.2
• Altair.HyperWorks.v12
• VoluMill.v6.1
• VoluMill.NEXION.6
• VERO.SurfCAM.v2014


Recent Articles
ASP GetTempName
Decode and Encode UTF-8
ASP GetFile
ASP FolderExists
ASP FileExists
ASP OpenTextFile
ASP FilesystemObject
ASP CreateFolder
ASP CreateTextFile
Javascript Get Selected Text


© Copyright codetoad.com 2001-2014