Atribut Type ASP
Definisi dan Penggunaan
Atribut Type digunakan untuk kembalikan tipe file atau folder yang ditentukan.
Sintaks:
FileObject.Type FolderObject.Type
Contoh untuk Objek File
Contoh 1
<% dim fs,f set fs=Server.CreateObject("Scripting.FileSystemObject") set f=fs.GetFile("c:test.txt") Response.Write("The file test.txt is of type: ") Response.Write("}}")f.Type) set f=nothing set fs=nothing %>
Output:
The file test.txt is of type: Text Document
Contoh 2
<% dim fs,f set fs=Server.CreateObject("Scripting.FileSystemObject") set f=fs.GetFile("c:test.asp") Response.Write("The file test.asp is of type: ") Response.Write("}}")f.Type) set f=nothing set fs=nothing %>
Output:
The file test.asp is of type: Active Server Document
Contoh untuk Objek Folder
<% dim fs,fo set fs=Server.CreateObject("Scripting.FileSystemObject") set fo=fs.GetFolder("c:\test") Response.Write("The folder test is of type: ") Response.Write("}}")fo.Type) set fo=nothing set fs=nothing %>
Output:
Tes folder adalah tipe: File Folder