加入收藏 | 设为首页 | 会员中心 | 我要投稿 聊城站长网 (https://www.0635zz.com/)- 智能语音交互、行业智能、AI应用、云计算、5G!
当前位置: 首页 > 站长学院 > Asp教程 > 正文

获取了附件大小、种类和最后更新时间来自ASP

发布时间:2023-08-24 14:30:24 所属栏目:Asp教程 来源:
导读:要得到生成的HTML文件的最后修改时间,写了一个函数,有简单的判断.

实例:

2005-11-10 19:33:44 ASP 文件 6.83 KB

把下面文件另存为mofei.asp文件,运行即可,要FSO支持.

Function fsofiledatemofe
要得到生成的HTML文件的最后修改时间,写了一个函数,有简单的判断.
 
实例:
 
2005-11-10 19:33:44 ASP 文件 6.83 KB
 
把下面文件另存为mofei.asp文件,运行即可,要FSO支持.
 
Function fsofiledatemofei(sfile)
 
'通过FSO得到文件的时间,类型,大小;sfile是文件名
 
'制作:默飞
 
'QQ:33224360
 
'HOME: http://www.8vb.cn
 
sfilere=""
 
Set fso = Server.CreateObject("Scripting.FileSystemObject")
 
if sfile="" or isnull(sfile) then sfile=Request.ServerVariables("SCRIPT_NAME")
 
if not fso.FileExists(server.Mappath(sfile)) then sfile=Request.ServerVariables("SCRIPT_NAME")
 
sfile=server.Mappath(sfile)
 
Set fsofile=fso.getfile(sfile)
 
sfilere=sfilere&fsofile.DateLastModified '文件时间
 
sfilere=sfilere&chr(9)&""&fsofile.type&"" '类型
 
sfilere=sfilere&chr(9)&round(fsofile.size*1000/1024/1000,2)&" KB" '大小
 
set fso=nothing
 
fsofiledatemofei=sfilere
 
End Function
 
response.write fsofiledatemofei("index.asp")
 
%>
 
很明显,修改"index.asp",改成你需要的文件,即可判断,都有注释,自己修改吧.
 
 

(编辑:聊城站长网)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章