Asp显示某文件夹下图片的程序

<%
Dim FolderName,Title

'Title为名称

FolderName为文件夹名称。

FolderName="Pictrue"
Title="图片List"

TruePath=server.MapPath(".")&"/"&FolderName
Response.Write TruePath
%>
<h1><font color=red><%=Title%></font></h1><br>
<table width="100%" border="0" cellspacing="0" cellpadding="0">


<%
'------------------------------------------------显示当前目录下的子目录和文件
Dim fso, f, f1, fc, s
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.GetFolder(TruePath)
set fs=f.SubFolders
Set fc =f.Files
i=1
For Each f1 in fc
dim filename
filename=f1.name
IF i=1 THen
%>
<tr>
<%
End IF
%>
<td align="center"><a href="<%=Replace(p2v_path(f1),"small","Big")%>" target="_blank"><Img border="0" width="200" src="<%=p2v_path(f1)%>"></a></td>
<%
If i=4 Then
i=0
%>
<%
End IF
i=i+1
Next

set fso=nothing
%>

</table>
<%
'-----------------------------------------------将文件路径转为www发布的路径这样就可以下载了
function p2v_path(p_path)
'p_path为硬盘上的物理路径
dim host
host=lcase(server.MapPath("/"))
p_path=lcase(p_path)
p2v_path=replace(p_path,host,const_domain_name)
end function
%>

 

注意:FolderName必须在此程序下。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值