ASP常用函数 储存单位转换函数:FormatFileSize()

网络整理 - 09-08

<%
'功能:储存单位转换函数
Function FormatFileSize(iSize)
    Dim aUnits, I
    aUnits = Array("B", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB")
    I = Log(Abs(iSize)) 7
    If I > UBound(aUnits) Then I = UBound(aUnits)
    FormatFileSize = FormatNumber(iSize / (1024 ^ I), 2, -1) & " " & aUnits(I)
End Function