ASP ဖိုင် Object
File object ကို သတ်မှတ်ထားသော ဖိုင်တစ်ခုနှင့် ပတ်သက်သော အချက်အလက်များကို ပြန်ပေးရန်အတွက် အသုံးပြုပါသည်။
နောက်ထပ် ဥပမာများ
သတ်မှတ်ထားသောဖိုင်ကို နောက်ဆုံးမွမ်းမံထားသည့် ရက်စွဲနှင့် အချိန်ကို မည်သို့ရယူရမည်နည်း။
သတ်မှတ်ထားသောဖိုင်ကို နောက်ဆုံးဝင်ရောက်ခဲ့သည့် ရက်စွဲနှင့်အချိန်ကို မည်သို့ရယူရမည်နည်း။
တစ်ခု၏ အရည်အချင်းများကို မည်သို့ပြန်ပေးမည်နည်း။
File Object ၊
File object ကို သတ်မှတ်ထားသော ဖိုင်တစ်ခုနှင့် ပတ်သက်သော အချက်အလက်များကို ပြန်ပေးရန်အတွက် အသုံးပြုပါသည်။
File object ၏ ဂုဏ်သတ္တိများနှင့် နည်းလမ်းများဖြင့် လုပ်ဆောင်ရန်၊ FileSystemObject object မှတဆင့် File object ၏ ဥပမာတစ်ခုကို ဖန်တီးရမည်ဖြစ်ပါသည်။ ပထမ၊ FileSystemObject အရာဝတ္တုကိုဖန်တီးပြီး FileSystemObject အရာဝတ္တု၏ GetFile နည်းလမ်းမှတဆင့် သို့မဟုတ် Folder အရာဝတ္တု၏ Files ပိုင်ဆိုင်မှုမှတစ်ဆင့် ဖိုင်ကို ချက်ချင်းလုပ်ဆောင်ပါ။
အောက်ပါကုဒ်သည် သတ်မှတ်ထားသော ဖိုင်ကို ဖန်တီးခဲ့သည့် ရက်စွဲကို ပြန်ပေးရန်အတွက် FileSystemObject object ၏ GetFile နည်းလမ်းကို အသုံးပြုသည်-
ဥပမာ
<%
Dim fs,f
Set fs=Server.CreateObject("Scripting.FileSystemObject")
Set f=fs.GetFile("c:\test.txt")
Response.Write("File created: " & f.DateCreated)
set f=nothing
set fs=nothing
%>
File object ၏ ဂုဏ်သတ္တိများနှင့် နည်းလမ်းများကို အောက်တွင် ဖော်ပြထားပါသည်။
သတ္တိ
Property | Description |
---|---|
Attributes | Sets or returns the attributes of a specified file |
DateCreated | Returns the date and time when a specified file was created |
DateLastAccessed | Returns the date and time when a specified file was last accessed |
DateLastModified | Returns the date and time when a specified file was last modified |
Drive | Returns the drive letter of the drive where a specified file or folder resides |
Name | Sets or returns the name of a specified file |
ParentFolder | Returns the folder object for the parent of the specified file |
Path | Returns the path for a specified file |
ShortName | Returns the short name of a specified file (the 8.3 naming convention) |
ShortPath | Returns the short path of a specified file (the 8.3 naming convention) |
Size | Returns the size, in bytes, of a specified file |
Type | Returns the type of a specified file |
နည်းလမ်းများ
Method | Description |
---|---|
Copy | Copies a specified file from one location to another |
Delete | Deletes a specified file |
Move | Moves a specified file from one location to another |
OpenAsTextStream | Opens a specified file and returns a TextStream object to access the file |