那位兄台能解燃眉之急!
我用filesystemobject对象的deletefile方法删除文件,用了server.mappath方法,可老是提示找不到文件。
部分代码如下:
<%set rs=server.CreateObject("adodb.recordset")
desql="SELECT contract.logo, img.image FROM contract INNER JOIN img ON contract.user_name = img.user_name WHERE (contract.user_name in("&stra&"))"
rs.open desql,conn,1,3
dim objfso,str1,str2
set objfso=server.CreateObject("Scripting.FileSystemObject")
while not rs.eof
str1=rs("logo")
str2=rs("image")
if objfso.fileExists(Server.MapPath("str1")) then
objfso.deletefile Server.MapPath("str1")
objfso.deletefile Server.MapPath("str2")
else objfso.deletefile Server.MapPath("str2")
end if
rs.movenext
wend
set objFSO = Nothing
set rs=nothing
%>
rs("logo")存的是路径:logo/文件名
其绝对路径是:e:/926/logo/文件名