File Size by using FSO
We can get the size of the file by using fileSystemobject . The file size is in bytes. We will check first if file exist or not and then we will check the size of the file. This file exists in the root of this script. Here is the code.
FilePath=Server.MapPath("text.txt") ' located in the same director
Set FSOobj = Server.CreateObject("Scripting.FileSystemObject")
if FSOobj.fileExists(FilePath) Then
Response.Write " File Size = " & details.Size & " Bytes "
Response.Write "File does not exist"
Set FSOobj = Nothing
Be the first to post comment on this article :