Once a text file has been created, it's very useful to be able to access it through an ASP script. This technique is often used to import large amounts of data into the application. Reading a text file also involves using the FileSystemObject object,
which has an OpenTextFile method. The OpenTextFile method has these parts:
- Object: (Required) Always the name of a FileSystemObject.
- Filename: (Required) String expression that identifies the file to open.
- Iomode: (Optional) Indicates input/output mode. Can be one of three constants,: ForReading (1), ForAppending (8), or (2) ForReading, which is the default.
- Create: (Optional) Boolean value that indicates whether a new file can be created if the specified filename doesn't exist (True to create the file, False not to create one). The default is False.
- Format: (Optional) If omitted, the file is opened as ASCII.
The snippet of code below shows a short example of using the object to read a text file through the OpenTextFile method.