Magic functions of FSO in ASP-Overview

Source: Internet
Author: User

Author: Gan jiping;

Source: http://www.15seconds.com/Issue/000816.htm

In ASP, FSO indicates a File System Object, that is, a File System Object.

The computer file system we want to manipulate is located on the web server. So confirm that you have the appropriate permissions. Ideally, you can create a web server on your own machine to facilitate testing. If you are running on Windows, try Microsoft's free personal Web Server PWS.

FSO model object

Drive Object: Drive Object for disk access or network Drive

FileSystemObject Object: File System Object for accessing the computer's File System

Folder Object: all attributes of a Folder Object for access

TextStream Object: Text Stream Object for accessing File Content

You can use the above objects to do anything on the computer, including destructive activities;-(so please be careful when using FSO. In the web environment, storing information is very important, such as user information, log files, and so on. FSO provides a powerful and simple way to efficiently store data. In this article, we will focus on FileSystemObject and TextStream objects.

FSO is supported by Microsoft and cannot be used for non-Windows systems.

How to Use FSO?

To use FSO to execute all the work, you must first create an object. The Code is as follows:

<%

Set fso = Server. CreateObject ("Scripting. FileSystemObject ")

%>

In this way, the FSO is created and the variable fso is assigned, and then the familiar object can be used. method syntax to perform operations on the file system (view the Visual Basic documentation to learn more about object and object wizard programming 〕. Here, we can use fso. method or fso. property, which will be seen in the following example.

The FSO model is located in the script run time DLL file provided by Microsoft. It is scrrun. dll. You can reference this DLL file in any application, such as MS Access and Word. That is to say, it is not limited to be applied in ASP.

Here is a brief list of FSO methods:

FSO Method

CopyFile: copy one or more files to the new path.

CreateTextFile: Creates a file and returns a TextStream object.

DeleteFile: delete an object

OpenTextFile open the file and return the TextStream object for reading or appending

For more information about FSO methods and attributes, see Microsoft MSDN. Here are several examples.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.