Atrybut Type w ASP
Definicja i użycie
Atrybut Type służy do zwracania typu określonego pliku lub katalogu.
Gramatyka:
FileObject.Type FolderObject.Type
Przykład dla obiektu File
Przykład 1
<% zmień fs,f ustaw fs=Server.CreateObject("Scripting.FileSystemObject") ustaw f=fs.GetFile("c:test.txt") Response.Write("The file test.txt is of type: ") Response.Write("}}")f.Type) ustaw f=nothing ustaw fs=nothing %>
Wynik:
The file test.txt is of type: Text Document
Przykład 2
<% zmień fs,f ustaw fs=Server.CreateObject("Scripting.FileSystemObject") ustaw f=fs.GetFile("c:test.asp") Response.Write("The file test.asp is of type: ") Response.Write("}}")f.Type) ustaw f=nothing ustaw fs=nothing %>
Wynik:
The file test.asp is of type: Active Server Document
Przykład dla obiektu Folder
<% zmień fs,fo ustaw fs=Server.CreateObject("Scripting.FileSystemObject") ustaw fo=fs.GetFolder("c:\test") Response.Write("The folder test is of type: ") Response.Write("}}")fo.Type) ustaw fo=nothing ustaw fs=nothing %>
Wynik:
Test folderu: Typ: Plik Folder