Atribut Type ASP

Definisi dan Penggunaan

Atribut Type digunakan untuk kembalikan jenis fail atau folder yang ditentukan.

Syarat:

FileObject.Type
FolderObject.Type

Contoh untuk objek Fail

Contoh 1

<%
dim fs,f
set fs=Server.CreateObject("Scripting.FileSystemObject")
set f=fs.GetFile("c:test.txt")
Response.Write("Fail test.txt adalah jenis: ")
Response.Write("}}")f.Type)
set f=nothing
set fs=nothing
%>

Output:

Fail test.txt adalah jenis: Dokumen Teks

Contoh 2

<%
dim fs,f
set fs=Server.CreateObject("Scripting.FileSystemObject")
set f=fs.GetFile("c:test.asp")
Response.Write("Fail test.asp adalah jenis: ")
Response.Write("}}")f.Type)
set f=nothing
set fs=nothing
%>

Output:

Fail test.asp adalah jenis: Dokumen Server Aktif

Contoh untuk objek Folder

<%
dim fs,fo
set fs=Server.CreateObject("Scripting.FileSystemObject")
set fo=fs.GetFolder("c:\test")
Response.Write("Tajuk folder test adalah jenis: ")
Response.Write("}}")fo.Type)
set fo=nothing
set fs=nothing
%>

Output:

Pengujian folder adalah jenis: File Folder