教程集 www.jiaochengji.com
教程集 >  脚本编程  >  Asp.net  >  正文 asp获取文件大小

asp获取文件大小

发布时间:2016-09-25   编辑:jiaochengji.com
教程集为您提供asp获取文件大小等资源,欢迎您收藏本站,我们将为您提供最新的asp获取文件大小资源

'函数作用:获取文件大小
function getfilesize(filename)
    '判断文件名是不是为空
 if filename="" then
  getfilesize="0kb"
  exit function
 end if
 dim ofso,ofile,sfile
 sfile=filename
 set ofso=server.createobject("scripting.filesystemobject")
  '判断获取文件大小的文件是否存在
 if ofso.fileexists(server.mappath(sfile)) then 
 set ofile=ofso.getfile(server.mappath(sfile))
  '判断获取文件大小
 getfilesize= cstr( cdbl( formatnumber( ofile.size / 1024))) & "kb"
 else
     getfilesize="0kb"
  exit function
 end if
 set ofile=nothing
 set ofso=nothing
end function

您可能感兴趣的文章:
php和asp语法上的区别是什么
asp获取文件大小
从ASP迁移至ASP --最初的考虑(一)
ASP 全新接触(1)
ASP内建对象Response
突破性的ASP 技术
asp入门:Request.QueryString实例教程
有关微软新一代开发技术ASP 的介绍
PHP巧获服务器端信息
ASP Application 对象教程

[关闭]
~ ~