Recommended: ASP instance tutorial: Form collection Note for Form collections: Because this ASP instance tutorial is about the code of the form, I will not take screenshots in order to save trouble! Everyone tests the execution results of the examples by themselves! A simple application of a Form collection This example demonstrates how a Form collection can retrieve values from a form. This form uses the POST method, which means that the message sent is invisible to the user and is for the sent message
FileSystemObject Object
Does the specified file exist?
This example demonstrates how to first create a FileSystemObject object, and then use the FileExists method to detect whether a file exists.
The code for this example is as follows:
The following is the quoted content: <html> <body> <% Set fs=Server.CreateObject(Scripting.FileSystemObject) If (fs.FileExists(c:/windows/cursors/xxx.cur))=true Then Response.Write(File c:/windows/cursors/xxx.cur exists.) Else Response.Write(File c:/windows/cursors/xxx.cur does not exist.) End If set fs=nothing %> </body> </html> |
The operation results of this example are as follows:
The file c:/windows/cursors/xxx.cur does not exist.
Does the specified folder exist?
This example demonstrates how to use the FolderExists method to detect whether a folder exists.
The code for this example is as follows:
The following is the quoted content: <html> <body> <% Set fs=Server.CreateObject(Scripting.FileSystemObject) If fs.FolderExists(c:/temp) = true Then Response.Write(Folder c:/temp exists.) Else Response.Write(Folder c:/temp does not exist.) End If set fs=nothing %> </body> </html> |
The operation results of this example are as follows:
The folder c:/temp does not exist.
Does the specified drive exist?
This example demonstrates how to use the DriveExists method to detect whether a drive exists.
The code for this example is as follows:
The following is the quoted content: <html> <body> <% Set fs=Server.CreateObject(Scripting.FileSystemObject) if fs.driveexists(c:) = true then Response.Write(Drive c: exists.) Else Response.Write(Drive c: does not exist.) End If Response.write(<br>) if fs.driveexists(g:) = true then Response.Write(Drive g: exists.) Else Response.Write(Drive g: does not exist.) End If set fs=nothing %> </body> </html> |
The operation results of this example are as follows:
Drive c: exists.
Drive g: exists.
Get the name of a specified drive
This example shows how to use the GetDriveName method to get the name of a specified drive.
The code for this example is as follows:
The following is the quoted content: <html> <body> <% Set fs=Server.CreateObject(Scripting.FileSystemObject) p=fs.GetDriveName(c:/windows/cursors/abc.cur) Response.Write (drive name is: & p) set fs=nothing %> </body> </html> |
The operation results of this example are as follows:
The drive name is: c:
Get the name of the parent folder of a specified path
This example shows how to use the GetParentFolderName method to get the name of the parent folder of a specified path.
The code for this example is as follows:
The following is the quoted content: <html> <body> <% Set fs=Server.CreateObject(Scripting.FileSystemObject) p=fs.GetParentFolderName(c:/winnt/cursors/3dgarro.cur) Response.Write(c:/windows/cursors/abc.cur's parent folder name is: & p) set fs=nothing %> </body> </html> |
The operation results of this example are as follows:
The parent folder name of c:/winnt/cursors/abc.cur is: c:/winnt/cursors
Get the folder extension
This example shows how to use the GetExtensionName method to get the file extension of the last component in the specified path.
The code for this example is as follows:
The following is the quoted content: <html> <body> <% Set fs=Server.CreateObject(Scripting.FileSystemObject) Response.Write (the file extension of file 3dgarro is:) Response.Write(fs.GetExtensionName(c:/windows/cursors/abc.cur)) set fs=nothing %> </body> </html> |
The operation results of this example are as follows:
The file extension of file 3dgarro is: cur
Obtain file name
This example shows how to use the GetFileName method to get the file name of the last component in the specified path.
The code for this example is as follows:
The following is the quoted content: <html> <body> <% Set fs=Server.CreateObject(Scripting.FileSystemObject) Response.Write (The last component of this file name is:) Response.Write(fs.GetFileName(c:/windows/cursors/abc.cur)) set fs=nothing %> </body> </html> |
The operation results of this example are as follows:
The last ingredient of this file name is: abc.cur
Get the base name of the file or folder
This example shows how to use the GetBaseName method to return the base name of a file or folder in the specified path.
This example code is as follows:
The following is the quoted content: <html> <body> <% Set fs=Server.CreateObject(Scripting.FileSystemObject) Response.Write(fs.GetBaseName(c:/windows/cursors/abc.cur)) Response.Write(<br />) Response.Write(fs.GetBaseName(c:/windows/cursors/)) Response.Write(<br />) Response.Write(fs.GetBaseName(c:/windows/)) set fs=nothing %> </body> </html> |
The operation results of this example are as follows:
The following is the quoted content: abc Cursors Windows |
Share: Compare several Access online management tools ACCESS database is still used frequently by individual webmasters, so various ACCESS online management tools have also emerged. Let’s take a look at the advantages and disadvantages of the current popular ones: Let’s evaluate the following tools: Ancient Access Online Management, Hujige Access Database Management Tool, access2008.cn ACCESS Online Management System