Ασπ Type ιδιότητα
Ορισμός και χρήση
Η ιδιότητα Type χρησιμοποιείται για να επιστρέψει τον τύπο του καθορισμένου αρχείου ή φακέλου.
Γλώσσα:
FileObject.Type FolderObject.Type
Παράδειγμα για αντικείμενο File
Παράδειγμα 1
<% dim fs,f set fs=Server.CreateObject("Scripting.FileSystemObject") set f=fs.GetFile("c:test.txt") Response.Write("Το αρχείο test.txt είναι τύπου:") Response.Write(f.Type) set f=nothing set fs=nothing %>
Έξοδος:
Το αρχείο test.txt είναι τύπου: Text Document
Παράδειγμα 2
<% dim fs,f set fs=Server.CreateObject("Scripting.FileSystemObject") set f=fs.GetFile("c:test.asp") Response.Write("Το αρχείο test.asp είναι τύπου:") Response.Write(f.Type) set f=nothing set fs=nothing %>
Έξοδος:
Το αρχείο test.asp είναι τύπου: Active Server Document
Παράδειγμα για αντικείμενο Folder
<% dim fs,fo set fs=Server.CreateObject("Scripting.FileSystemObject") set fo=fs.GetFolder("c:\test") Response.Write("Το φάκελος test είναι τύπου:") Response.Write(fo.Type) set fo=nothing set fs=nothing %>
Έξοδος:
Ο έλεγχος του φακέλου είναι τύπου: File Folder