关于硬盘图片直读asp代码问题!
代码如下,但是TruePath无论怎么设置都提示"找不到文件夹!可能是配置有误! ",请知道的朋友告诉我,谢谢!20分
<%
Set Fso=server.createobject("scripting.filesystemobject")
TruePath=Server.MapPath("/photo/photo/uesr/pop111/")
if fso.FolderExists(TruePath) then
FileCount=0
TotleSize=0
Set theFolder=fso.GetFolder(TruePath)
For Each theFile In theFolder.Files
FileCount=FileCount+1
TotleSize=TotleSize+theFile.Size
next
totalPut=FileCount
if currentpage<1 then
currentpage=1
end if
if (currentpage-1)*MaxPerPage>totalput then
if (totalPut mod MaxPerPage)=0 then
currentpage= totalPut \ MaxPerPage
else
currentpage= totalPut \ MaxPerPage + 1
end if
end if
if currentPage=1 then
showContent
showpage strFileName,totalput,MaxPerPage
response.write "<br><div align='center'>±¾Ò³¹²ÏÔʾ <b>" & FileCount-1 & "</b> ¸öÎļþ£¬Õ¼Óà <b>" & TotleSize\1024 & "</b> K</div>"
else
if (currentPage-1)*MaxPerPage<totalPut then
showContent
showpage strFileName,totalput,MaxPerPage
response.write "<br><div align='center'>±¾Ò³¹²ÏÔʾ <b>" & FileCount-1 & "</b> ¸öÎļþ£¬Õ¼Óà <b>" & TotleSize\1024 & "</b> K</div>"
else
currentPage=1
showContent
showpage strFileName,totalput,MaxPerPage
response.write "<br><div align='center'>±¾Ò³¹²ÏÔʾ <b>" & FileCount-1 & "</b> ¸öÎļþ£¬Õ¼Óà <b>" & TotleSize\1024 & "</b> K</div>"
end if
end if
else
response.write "ÕÒ²»µ½Îļþ¼Ð£¡¿ÉÄÜÊÇÅäÖÃÓÐÎó£¡"
end if
'end if
sub showContent()
dim c
FileCount=1
TotleSize=1
%>
<table width="100%" border="0" align="center" cellpadding="5" cellspacing="5">
<tr class="tdbg">
<% For Each theFile In theFolder.Files
c=c+1
if FileCount>MaxPerPage then
exit for
elseif c>MaxPerPage*(CurrentPage-1) then %>
<td><a href="<%=(UploadDir & theFile.Name)%>" target="_blank">
<img src=<%=(UploadDir & theFile.Name)%> border=0 width=120 height=150></a></td>
<% if FileCount mod 4 =0 then%>
</TR>
<tr>
<%end if%>
<% FileCount=FileCount+1
TotleSize=TotleSize+theFile.Size
end if
Next
%> </tr>
</table>
<%
end sub
%>
</td>
</tr>
</table>
<%
sub showpage(sfilename,totalnumber,maxperpage)
dim n, i,strTemp
if totalnumber mod maxperpage=0 then
n= totalnumber \ maxperpage
else
n= totalnumber \ maxperpage+1
end if
strTemp= "<table align='center'><form name='showpages' method='Post' action='" & sfilename & "'><tr><td>"
strTemp=strTemp & "¹² <b>" & totalnumber & "</b> ÕÅÕÕÆ¬ "
if CurrentPage<2 then
strTemp=strTemp & "Ê×Ò³ ÉÏÒ»Ò³ "
else
strTemp=strTemp & "<a href='" & sfilename & "page=1'>Ê×Ò³</a> "
strTemp=strTemp & "<a href='" & sfilename & "page=" & (CurrentPage-1) & "'>ÉÏÒ»Ò³</a> "
end if
if n-currentpage<1 then
strTemp=strTemp & "ÏÂÒ»Ò³ βҳ"
else
strTemp=strTemp & "<a href='" & sfilename & "page=" & (CurrentPage+1) & "'>ÏÂÒ»Ò³</a> "
strTemp=strTemp & "<a href='" & sfilename & "page=" & n & "'>βҳ</a>"
end if
strTemp=strTemp & " Ò³´Î£º<strong><font color=red>" & CurrentPage & "</font>/" & n & "</strong>Ò³ "
strTemp=strTemp & " <b>" & maxperpage & "</b>" & "¸öÎļþ/Ò³"
strTemp=strTemp & " תµ½£º<select name='page' size='1' onchange='javascript:submit()'>"
for i = 1 to n
strTemp=strTemp & "<option value='" & i & "'"
if cint(CurrentPage)=cint(i) then strTemp=strTemp & " selected "
strTemp=strTemp & ">µÚ" & i & "Ò³</option>"
next
strTemp=strTemp & "</select>"
strTemp=strTemp & "</td></tr></form></table>"
strTemp=strTemp & "<font color='#0083AE'> "
strTemp=strTemp & "Copyright 2005 All Rights Reserved ËïÞ±&Ò¶¿¡ÄÜ °æÈ¨ËùÓÐ <br>"
strTemp=strTemp & "Éè¼ÆÖÆ×÷£º½ªÁ¢²¨</font>"
response.write strTemp
end sub
%>