现在能成功删除数据库表中的数据,但虚拟主机的本地文件没有被删除?望大神帮忙,感激不尽!
-------
文件浏览页面(ckwj.asp):
程序代码:
<%call ycsxpic()%>
<%sub ycsxpic()
set rs1=Server.CreateObject("ADODB.Recordset")
rsppl="select * from [data] order by id desc"
rs1.open rsppl,conn,1,2
if rs1.eof then
response.write("暂无文件。<br/>")
else
pag=10
page=cint(request.QueryString("page"))
if page="" or page<1 then page=1
maxpage=int((rs1.recordcount-1)/pag)+1
if page>maxpage then page=maxpage
rs1.Move((page-1)*pag)
l=1
do while ((not rs1.EOF) and 0 <=cint(pag))
%><div style="background:#ffeeff;font-size:13px;"><img src='<%=rs1("datadir")%>'/><br/>
<%=((page-1)*pag+l)%>.路径:down/<%=rs1("dataname")%>
<%size=Round(rs1("filesize")/1024,2)
If Left(size,1)="." Then size="0"&size%>
大小:<%=size%>KB[<a href='ckwj_del.asp?vs=<%=vs%>&file=<%=rs1("datadir")%>&ID=<%=rs1("id")%>&sb=<%=sb%>'>删除</a>]</div><br/>
<%
rs1.MoveNext
l=l+1
loop
end if
if page*pag<rs1.recordcount then response.write("<a href='ckwj.asp?vs="&vs&"&id="&id&"&page=" & page+1 & "&sb="&sb&"'>下一页</a>")
if page>1 then response.write("<a href='ckwj.asp?vs="&vs&"&id="&id&"&page=" & page-1 & "&sb="&sb&"'>上一页</a>")
if page>1 then response.write("<a href='ckwj.asp?vs="&vs&"&id="&id&"&page=10000&sb="&sb&"'>尾页</a>")
if page>1 then response.write("<a href='ckwj.asp?vs="&vs&"&id="&id&"&page=0&sb="&sb&"'>首页</a><br/>")
%>共[<%=rs1.recordcount%>]条<br/>复制
删除页面(ckwj_del.asp):
程序代码:
<%if id="" then%>
注意:删除后将无法恢复!<br/>
<a href="ckwj_del.asp?sb=<%=sb%>&file=<%=file%>&id=<%=id%>">确认删除</a><br/>
<%else
file=request("file") <!--获取url传送过来的文件绝对路径-->
dim filename
filename=file
filename = Server.MapPath(filename)
Set MyFileObject=Server.CreateObject("Scripting.FileSystemObject")
If (MyFileObject.FileExists(trim(filename))) Then
MyFileObject.DeleteFile trim(filename)
end if
sql="delete from data Where CStr(id)='" & id & "'"
conn.Execute(sql)
response.write("删除成功!")
end if
%> |