SQL PHP HTML ASP JavaScript articles and free scripts to download
 

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.

<% Dim FSOobj,FilePath,details
FilePath=Server.MapPath("text.txt") ' located in the same director
Set FSOobj = Server.CreateObject("Scripting.FileSystemObject")
if FSOobj.fileExists(FilePath) Then
Set details=FSOobj.GetFile(Server.MapPath("text.txt"))
Response.Write " File Size = " & details.Size & " Bytes "
Else
Response.Write "File does not exist"
End if
Set FSOobj = Nothing
%>




Post Comment This is for short comments only. Use the forum for more discussions.
Name
Email( not to be displayed)Privacy Policy
1+2=This is to prevent automatic submission by spammers. Please enter the result of the sum as asked

Join Our Email List
Email:  
For Email Newsletters you can trust
File Management