Thuộc tính Size của ASP
Định nghĩa và cách sử dụng
Thuộc tính Size được sử dụng để trả về số byte của tệp hoặc thư mục cụ thể.
Cú pháp:
FileObject.Size FolderObject.Size
Ví dụ về đối tượng File
<% dim fs,f set fs=Server.CreateObject("Scripting.FileSystemObject") set f=fs.GetFile("c:\help.asp") Response.Write("Kích thước của test.asp là: ") Response.Write(f.Size & " bytes.") set f=nothing set fs=nothing %>
Kết quả xuất ra:
Kích thước của help.asp là: 15606 bytes.
Ví dụ về đối tượng Folder
<% dim fs,fo set fs=Server.CreateObject("Scripting.FileSystemObject") set fo=fs.GetFolder("c:\help") Response.Write("Kích thước của thư mục test là: ") Response.Write(fo.Size & " bytes.") set fo=nothing set fs=nothing %>
Kết quả xuất ra:
Kích thước của thư mục hỗ trợ là: 123456 bytes.