asp+fso在线管理图片功能 原创

时间:2021-05-28

复制代码 代码如下:
<%
'---------------------------------------------
'##############20060528新增加了对端口的支持
'作者:dxyQQ:461478385Email:douxy001@gmail.com
'功能完善
%>
<!--#includefile="global.asp"-->
<!--#includefile="session.asp"-->
<%
SetMyFile=Server.CreateObject("Scripting.FileSystemObject")
ifrequest.form("action")="delall"then
Num=request.form("delFileName").count
forx=1toNum
thedelall=Server.Mappath("../upload/"&request.form("delFileName")(x))
ifmyfile.fileexists(thedelall)then
myfile.deletefile(thedelall)
endif
next
endif
page=cint(request.querystring("page"))
ifPage<=1orPage=""thenPage=1
PageSize=25
Domain=Request.ServerVariables("SERVER_NAME")
gFilePath=Request.ServerVariables("PATH_INFO")
serverport=request.ServerVariables("SERVER_PORT")
gFilePath=lcase(left(gFilePath,instrRev(gFilePath,"/")))
CountN=len(gFilePath)
gFilePath=lcase(left(gFilePath,CountN-1))
gFilePath=lcase(left(gFilePath,instrRev(gFilePath,"/")))
ifserverport<>"80"then
AllPath="http://"&Domain&":"&serverport&gfilepath
else
AllPath="http://"&Domain&gfilepath
endif
filepath="../upload/"
dimfso
setfso=server.CreateObject("scripting.filesystemobject")
setthefolder=fso.getfolder(server.MapPath(filepath))
foreachffilesinthefolder.files
filecounts=filecounts+1
filesizes=filesizes+ffiles.size
iffilesizes=0then
response.write"此文件夹下没有内容"
response.end
endif
next

%>
<!DOCTYPEhtmlPUBLIC"-//W3C//DTDXHTML1.0Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<htmlxmlns="http://www.w3.org/1999/xhtml">
<head>
<metahttp-equiv="Content-Type"content="text/html;charset=gb2312"/>
<title>dxy文件管理器</title>
<linkhref="main.css"rel="stylesheet"type="text/css"/>
<scriptlanguage="javascript"type="text/javascript">
functionCheckAll()
{
for(varic=0;ic<form1.delfilename.length;ic++)
{
vare=form1.delfilename[ic];
e.checked=!e.checked;
}
}
</script>
</head>

<bodystyle="margin:0px;">
<tablewidth="760"border="0"align="center"cellpadding="3"cellspacing="1"bgcolor="#1F429E">
<formaction=""method="post"name="form1"><tr>
<tdwidth="40"height="25"bgcolor="#FFFFFF"><divalign="center">序号</div></td>
<tdwidth="493"height="25"bgcolor="#FFFFFF"><divalign="center">文件名</div></td>
<tdwidth="100"bgcolor="#FFFFFF"><divalign="center">文件大小</div></td>
<tdwidth="98"bgcolor="#FFFFFF"><divalign="center">选择</div></td>
</tr>
<%
i=0
foreachffilesinthefolder.files
i=i+1
ifccount>=pagesizethen
exitfor
elseifi>pagesize*(page-1)then
ccount=ccount+1
%>
<tr>
<tdheight="25"nowrap="nowrap"bgcolor="#FFFFFF"align="center"><%=i%></td>
<tdnowrap="nowrap"bgcolor="#FFFFFF"><ahref="<%=allpath&"upload/"&ffiles.name%>"target="_blank"><imgsrc=<%=allpath&"upload/"&ffiles.name%>border="0"/></a></td>
<tdnowrap="nowrap"bgcolor="#FFFFFF"><divalign="center"><%=ffiles.size%>[字节]</div></td>
<tdnowrap="nowrap"bgcolor="#FFFFFF">
<divalign="center">
<inputname="delfilename"type="checkbox"id="delfilename"value="<%=ffiles.name%>"/>
</div></td></tr>
<%
endif
next
%>
<tr>
<tdheight="30"colspan="4"bgcolor="#FFFFFF"><divalign="center">
共有文件<fontcolor="#FF0000"style="font-family:Georgia,'TimesNewRoman',Times,serif"><%=filecounts%></font>个,占用空间<fontcolor="#FF0000"style="font-family:Georgia,'TimesNewRoman',Times,serif"><%=formatnumber((filesizes/1024),2)%>k</font><br/>
<inputname="dxy_foldername"type="hidden"id="dxy_foldername"value="<%=request("dxy_foldername")%>"/>
<inputtype="button"name="Submit2"value="全选/反选"onclick="CheckAll()"/>
&nbsp;&nbsp;
<inputtype="submit"name="Submit"value="确定删除所选的文件"/>
</p>
<inputname="action"type="hidden"id="action"value="delall"/>
</div></td>
</tr>
</form>
</table>
<tablewidth="760"height="21"border="0"align="center"cellpadding="0"cellspacing="0">
<tr>
<tdbgcolor="#FFFFFF"><divalign="center">
<%
iffilecountsmodpagesize=0then
pagecount=filecounts/pagesize
else
pagecount=filecounts/pagesize+1
endif
ifpage>pagecountthen
page=pagecount
else
page=page
endif
forii=1toPageCount
ifpage=iithen
response.write"<ahref=picManage.asp?Page="&ii&">[<fontcolor=red>"&ii&"</font>]</a>"
else
response.write"<ahref=picManage.asp?Page="&ii&">["&ii&"]</a>"
endif
next
%>
</div></td>
</tr>
</table>
</body>
</html>

声明:本页内容来源网络,仅供用户参考;我单位不保证亦不表示资料全面及准确无误,也不保证亦不表示这些资料为最新信息,如因任何原因,本网内容或者用户因倚赖本网内容造成任何损失或损害,我单位将不会负任何法律责任。如涉及版权问题,请提交至online#300.cn邮箱联系删除。

相关文章