set Fs=Server.CreateObject("Scripting.FileSystemObject") pic="这里是路径" If Fs.FileExists(server.mappath(pic)) Then set Os = Fs.GetFile(server.mappath(pic)) Os.delete
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312" /> <title>图片删除</title> </head> <!--#include file="../include/Config.asp"--> <!--#include file="check_login.asp"--> <% img=request("img") response.write img set rs=server.CreateObject("adodb.recordset") sql="select * from corpuser_info where img='"&img&"'" rs.open sql,conn,3,3 db=rs("img") response.write db FilePath=Server.MapPath(db) Dim fso Set fso = CreateObject("Scripting.FileSystemObject") IF fso.FileExists(FilePath) Then fso.DeleteFile(FilePath) End IF Set fso = Nothing rs.close set rs=nothing