The FileSystemObject contains a library of objects, one of which is the File object. This object, as its name suggests, provides information relating to a file on the Web server. One of the properties of the File object is Size, which returns the size of the file in bytes. The FileSystemObject contains a method, GetFile(FilePath), which will return a File object that represents the file specified by FilePath.
So, putting this all together, we can get the size, in bytes, of a file on the Web server with the following code:
'What is the path of the file whose size you're interested in? Dim strFileName strFileName = "C:\FooBar\blah.txt"
'Create an instance of the FileSystemObject Dim objFSO Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
'Get a file object Dim objFile Set objFile = objFSO.GetFile(strFileName)
'Get the file size Dim iFileSize iFileSize = objFile.Size
Some of the products that appear on this site are from companies from which QuinStreet receives compensation. This compensation may impact how and where products appear on this site including, for example, the order in which they appear. QuinStreet does not include all companies or all types of products available in the marketplace.