日期:2014-05-17  浏览次数:20752 次

如何显示当前文件所占有的空间有多少M
如何显示当前文件所占有的空间有多少M?

ASP有这个功能语句吗?

------解决方案--------------------
<%@language=vbscript codepage=936 %>
<%
if session( "AdminName ")= " " then
response.write " <br> <p align=center> 您没有操作的权限 </p> "
response.end
end if
%>
<html>
<title> 系统空间占用 </title>
<link href= "admin/Style.css " rel= "stylesheet " type= "text/css ">
<meta NAME=GENERATOR Content= "Microsoft FrontPage 5.0 "Microsoft FrontPage 3.0 " " CHARSET=GB2312>
<BODY topmargin= "20 " style= "background-image: url( ' ') ">


<p>
<table cellpadding=0 cellspacing=0 border=0 width=95% bgcolor=#777777 align=center>
</p>
<tr>

<table width= "96% " border= "0 " align= "center " cellpadding= "3 " cellspacing= "1 " class= "tableBorder ">
<tr>
<th width= "27% " height=25 class= "tableHeaderText " colspan= "2 "> <div align= "center "> 系统空间的使用情况 </th>
</tr>
<tr>

<td width= "80% " valign=top class= "TableBody1 "> <div align= "center ">
<%
Sub ShowSpaceInfo(drvpath)
dim fso,d,size,showsize
set fso=server.createobject( "scripting.filesystemobject ")
drvpath=server.mappath(drvpath)
set d=fso.getfolder(drvpath)
size=d.size
showsize=size & "&nbsp;Byte "
if size> 1024 then
size=(size\1024)
showsize=size & "&nbsp;KB "
end if
if size> 1024 then
size=(size/1024)
showsize=formatnumber(size,2) & "&nbsp;MB "
end if
if size> 1024 then
size=(size/1024)
showsize=formatnumber(size,2) & "&nbsp;GB "
end if
response.write " <font face=verdana> " & showsize & " </font> "
End Sub

Sub Showspecialspaceinfo(method)
dim fso,d,fc,f1,size,showsize,drvpath
set fso=server.createobject( "scripting.filesystemobject ")
drvpath=server.mappath( "pic ")
drvpath=left(drvpath,(instrrev(drvpath, "\ ")-1))
set d=fso.getfolder(drvpath)

if method= "All " then
size=d.size
elseif method= "Program " then
set fc=d.Files
for each f1 in fc
size=size+f1.size
next
end if

showsize=size & "&nbsp;Byte "
if size> 1024 then
size=(size\1024)
showsize=size & "&nbsp;KB "
end if
if size> 1024 then
size=(size/1024)
showsize=formatnumber(size,2) & "&nbsp;MB "
end if
if size> 1024 then
size=(size/1024)
showsize=formatnumber(size,2) & "&nbsp;GB "
end if
response.write " <font face=verdana> " & showsize & " </font> "
end sub

Function Drawbar(drvpath)
dim fso,drvpathroot,d,size,totalsize,barsize
set fso=server.createobject( "scripting.f