Wrance的图片系统目录直读版1.0_ASP教程-查字典教程网
Wrance的图片系统目录直读版1.0
Wrance的图片系统目录直读版1.0
发布时间:2016-12-29 来源:查字典编辑
摘要:复制代码代码如下:MaxPerPagethenexitforelseifc>MaxPerPage*(CurrentPage-1)then%>

复制代码 代码如下:

<%@language=vbscriptcodepage=936%>

<%

'++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

'++++++Wrance的图片系统目录直读版1.0+++++++++++++++++++++++

'++++++演示:http://www.cnecg.com/pic.asp++++++++++++++++++

'++++++此为免费程序,您可以任意修改,欢迎发表建议++++++++++

'++++++Email:cnecg@yahoo.com.cn,QQ:74028+++++++++++++++++++

'以下为修改内容

ConstUploadDir="/ecg/upload/news/"'存放文件的目录

ConstMaxPerPage=30'每页显示数量

consttitle="+++__Wrance的图片系统目录直读版_"'标题

'检查组件是否已经安装

FunctionIsObjInstalled(strClassString)

IsObjInstalled=False

Err=0

DimxTestObj

SetxTestObj=Server.CreateObject(strClassString)

If0=ErrThenIsObjInstalled=True

SetxTestObj=Nothing

Err=0

EndFunction

dimstrFileName

dimtotalPut,CurrentPage,TotalPages

dimTruePath,fso,theFolder,theFile,whichfile,thisfile,FileCount,TotleSize

strFileName="?"

ifrequest("page")<>""then

currentPage=cint(request("page"))

else

currentPage=1

endif

TruePath=Server.MapPath(UploadDir)

IfnotIsObjInstalled("Scripting.FileSystemObject")Then

Response.Write"<b><fontcolor=red>你的服务器不支持FSO(Scripting.FileSystemObject)!不能使用本功能</font></b>"

Else

setfso=CreateObject("Scripting.FileSystemObject")

%>

<html>

<head>

<title><%=title%></title>

<metahttp-equiv="Content-Type"content="text/html;charset=gb2312">

<styletype="text/css">

<>

</style>

</head>

<body>

<divalign=center>

<%=title%><br>

<tablewidth="100%"height="100%"border="0"cellpadding="0"cellspacing="0">

<tr>

<tdwidth="100%"align="center"valign="top">

<%

iffso.FolderExists(TruePath)then

FileCount=0

TotleSize=0

SettheFolder=fso.GetFolder(TruePath)

ForEachtheFileIntheFolder.Files

FileCount=FileCount+1

TotleSize=TotleSize+theFile.Size

next

totalPut=FileCount

ifcurrentpage<1then

currentpage=1

endif

if(currentpage-1)*MaxPerPage>totalputthen

if(totalPutmodMaxPerPage)=0then

currentpage=totalPutMaxPerPage

else

currentpage=totalPutMaxPerPage+1

endif

endif

ifcurrentPage=1then

showContent

showpage2strFileName,totalput,MaxPerPage

response.write"<br><divalign='center'>本页共显示<b>"&FileCount-1&"</b>个文件,占用<b>"&TotleSize1024&"</b>K</div>"

else

if(currentPage-1)*MaxPerPage<totalPutthen

showContent

showpage2strFileName,totalput,MaxPerPage

response.write"<br><divalign='center'>本页共显示<b>"&FileCount-1&"</b>个文件,占用<b>"&TotleSize1024&"</b>K</div>"

else

currentPage=1

showContent

showpage2strFileName,totalput,MaxPerPage

response.write"<br><divalign='center'>本页共显示<b>"&FileCount-1&"</b>个文件,占用<b>"&TotleSize1024&"</b>K</div>"

endif

endif

else

response.write"找不到文件夹!可能是配置有误!"

endif

endif

subshowContent()

dimc

FileCount=1

TotleSize=0

%>

<tablewidth="100%"border="0"align="center"cellpadding="5"cellspacing="5">

<trclass="tdbg">

<%ForEachtheFileIntheFolder.Files

c=c+1

ifFileCount>MaxPerPagethen

exitfor

elseifc>MaxPerPage*(CurrentPage-1)then%>

<td><ahref="<%=(UploadDir&theFile.Name)%>"target="_blank">

<imgsrc=<%=(UploadDir&theFile.Name)%>border=0width=120height=150></a></td>

<%ifFileCountmod5=0then%>

</TR>

<tr>

<%endif%>

<%FileCount=FileCount+1

TotleSize=TotleSize+theFile.Size

endif

Next

%></tr>

</table>

<%

endsub

%>

</td>

</tr>

</table>

<%

subshowpage2(sfilename,totalnumber,maxperpage)

dimn,i,strTemp

iftotalnumbermodmaxperpage=0then

n=totalnumbermaxperpage

else

n=totalnumbermaxperpage+1

endif

strTemp="<tablealign='center'><formname='showpages'method='Post'action='"&sfilename&"'><tr><td>"

strTemp=strTemp&"共<b>"&totalnumber&"</b>个文件"

ifCurrentPage<2then

strTemp=strTemp&"首页上一页"

else

strTemp=strTemp&"<ahref='"&sfilename&"page=1'>首页</a>"

strTemp=strTemp&"<ahref='"&sfilename&"page="&(CurrentPage-1)&"'>上一页</a>"

endif

ifn-currentpage<1then

strTemp=strTemp&"下一页尾页"

else

strTemp=strTemp&"<ahref='"&sfilename&"page="&(CurrentPage+1)&"'>下一页</a>"

strTemp=strTemp&"<ahref='"&sfilename&"page="&n&"'>尾页</a>"

endif

strTemp=strTemp&"页次:<strong><fontcolor=red>"&CurrentPage&"</font>/"&n&"</strong>页"

strTemp=strTemp&"<b>"&maxperpage&"</b>"&"个文件/页"

strTemp=strTemp&"转到:<selectname='page'size='1'onchange='javascript:submit()'>"

fori=1ton

strTemp=strTemp&"<optionvalue='"&i&"'"

ifcint(CurrentPage)=cint(i)thenstrTemp=strTemp&"selected"

strTemp=strTemp&">第"&i&"页</option>"

next

strTemp=strTemp&"</select>"

strTemp=strTemp&"</td></tr></form></table>"

strTemp=strTemp&"<fontcolor='#0083AE'>"

strTemp=strTemp&"Copyright2004CnEcg.comAllRightsReserved版权所有+++__Wrance的图片系统目录直读版_1.0<br>"

strTemp=strTemp&"设计制作:WranceEmail:cnecg@yahoo.com.cnQQ:74028</font>"

response.writestrTemp

endsub

%>

相关阅读
推荐文章
猜你喜欢
附近的人在看
推荐阅读
拓展阅读
  • 大家都在看
  • 小编推荐
  • 猜你喜欢
  • 最新ASP教程学习
    热门ASP教程学习
    编程开发子分类