ASP Type 属性

定义和用法

Type 属性用于返回指定的文件或文件夹的类型。

语法:

  1. FileObject.Type
  2. FolderObject.Type

针对 File 对象的例子

  1. <%
  2. dim fs,f
  3. set fs=Server.CreateObject("Scripting.FileSystemObject")
  4. set f=fs.GetFile("c:help.txt")
  5. Response.Write("The file test.txt is of type: ")
  6. Response.Write(f.Type)
  7. set f=nothing
  8. set fs=nothing
  9. %>

输出:

  1. The file help.txt is of type: Text Document

针对 Folder 对象的例子

  1. <%
  2. dim fs,f
  3. set fs=Server.CreateObject("Scripting.FileSystemObject")
  4. set f=fs.GetFile("c:help.asp")
  5. Response.Write("The file test.asp is of type: ")
  6. Response.Write(f.Type)
  7. set f=nothing
  8. set fs=nothing
  9. %>

输出:

  1. The file help.asp is of type: Active Server Document