ASP
Here you can find some FREE usefull Classic ASP / VBScript code snippets, class modules, etc.
Function FileLen(String) Long
Return a local file size in bytes.
Example
<% response.write "My local file is " & FileLen("files/sample.exe") & " bytes long!" %> Source Code <%
Function FileLen(filename) Dim objFSO, objFLE, filepath if mid(filename,2,1)<>":" and left(filename,2)<>"\\" then filepath = Server.MapPath(filename) else filepath=filename On Error Resume Next FileLen=0 Set objFSO = CreateObject("Scripting.FileSystemObject") If Err.Number = 0 Then Set objFLE = objFSO.GetFile(filepath) FileLen=objFLE.Size end if Set objFLE = Nothing: Set objFSO = Nothing On Error Goto 0 End Function %> |