The Magic function of the FSO in ASP-Brief introduction _FSO Special topic

Source: Internet
Author: User
Author: Gan Ganping;


Original source: http://www.15seconds.com/Issue/000816.htm

In ASP, the FSO means the file system object, which is the filesystem objects.

We are going to manipulate the computer file system, which is located above the Web server. So, make sure you have the right permissions for this. Ideally, you can set up a Web server on your own machine so that you can easily test it. If you are running on a Windows platform, try Microsoft's free personal Web server PWS.

FSO Model Object
Drive object: Drive objects for access to disks or network drives
FileSystemObject object: File system objects for accessing a computer's file system
Folder object: Folders objects for accessing all properties of a folder
TextStream object: Text Stream objects for accessing file contents

You can use the object above to do anything on the computer, including sabotage;-( Therefore, please use the FSO carefully. In a Web environment, storing information is very important, such as user information, log files, and so on. The FSO provides a powerful and easy way to save data efficiently. In this article, we focus on FileSystemObject and TextStream objects.

FSO is supported by Microsoft and presumably no longer uses ASP for non-Windows systems.

How to use the FSO?

To perform all of the work using the FSO, you first create the object, as in the following code:

<%
Set FSO = Server.CreateObject ("Scripting.FileSystemObject")
% >

This creates the FSO and assigns the variable FSO, and then you can use the familiar Object.Method syntax to perform file system operations (view the Visual Basic documentation for more information on 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 runtime DLL file provided by Microsoft, which is scrrun.dll. You can refer to this DLL file in any application, such as Ms Access,word. That is, it is not limited to applying it in ASP.

Here is a brief list of FSO methods:

Fso method
CopyFile copy one or more files to a new path
CreateTextFile creates a file and returns a TextStream object
DeleteFile Delete a file
OpenTextFile opens the file and returns the TextStream object to read or append

For full FSO methods and properties, check out Microsoft MSDN. Let's look at a few examples.

Related Article

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.