Get File Size into a variable
Hello everyone,
I need to get the size of a file and stick the value into a variable.
I can get the absolute path of the file in question, but when I try to use the FilSystem Object to get the file properties, I keep getting errors.
Here's where I am so far:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<%
dim cn
dim cmd
set cn = server.CreateObject("ADODB.Connection")
cn.ConnectionString = MM_ConGL_STRING
cn.ConnectionTimeout = 30
cn.Open
cc_dld = request.QueryString("cc_dld") = "yes"
sc_dld = request.QueryString("sc_dld") = "yes"
s_dld = request.QueryString("s_dld") = "yes"
ndlid = DMax("DLID","Downloads","") 'gets id of file previously inserted
if cc_dld then
id = BestLong(request.querystring("ccid")) 'BestLong converts string to number
elseif sc_dld then
id = BestLong(request.querystring("scid"))
elseif s_dld then
id = BestLong(request.querystring("sid"))
end if
filelink = DLookup("DLLink","Downloads","DLID=" & dlid) 'gets relative path of file
filename = Right(filelink, Len(filelink) - InStrRev(filelink, "/", -1, 1))
filepath = Server.MapPath("/gl/admin/documents/")
filespec = filepath & "\" & filename
dim objFSO
set objFSO = server.CreateObject("Scripting.FileSystemObject")
%>
I'll have some inserts and updates after I get the size of the file in 'filespec'
How can I get the size of the file specified in the absolute path 'filespec' into a variable that I can then insert into a table?
I've tried using objFSO.Size(filespec) but it doesn't like that. Does anyone know what I'm doing wrong?
Thanks,
Brandon
bT
|