<%
function readfile(filename)
on error resume next
err.clear
'asp的一种校错方法
const forreading = 2
const create = false
dim fso
dim ts
dim filepath
dim thefile
dim content
'---------------操作地址
set fso=server.createobject("scripting.filesystemobject")
filepath=server.mappath("temp") ./记录本存放的文件夹
if err.number<>0 then
response.write "目录不存在"
response.end
end if
'filename="test.txt" ---------test.txt为你从数据库里读出的文件名
thefile=filepath&"/"&filename
set ts = fso.opentextfile(thefile,1)
do until ts.atendofstream
response.write (""&ts.readline&"")
response.write("<br>")
loop
set ts = nothing
set fso = nothing
end function
%>
<%
dim id
dim filename
id=6
set rs=server.createobject("adodb.recordset")
sql="select * from yuan where id="&id
rs.open sql,cn,1,1
filename=rs("fileload")
%>
<% readfile(filename) %>
【说明】:本文章由站长整理发布,文章内容不代表本站观点,如文中有侵权行为,请与本站客服联系(QQ:)!