此代码为最精简的删除方式,根据实际加以修改可灵活应用
'程序名:delfile.asp
'关键参数:strUploadFiles 文件名称
例:<a href="delfile.asp?Action=test.rar">删除test.rar文件</a>
<%
strUploadFiles=Trim(Request.QueryString("strUploadFiles"))
Action=Trim(Request.QueryString("Action"))
response.write "成功删除<font color=red>"&strUploadFiles&"</font>文件!"
call delfiles(strUploadFiles & "")
sub DelFiles(strUploadFiles)
if strUploadFiles="" then exit sub
dim fso,arrUploadFiles,i
Set fso = CreateObject("Scripting.FileSystemObject")
fso.DeleteFile(server.MapPath("" & strUploadfiles))
Set fso = nothing
response.write"<SCRIPT language=javascript>alert('成功删除文件,将返回上一页!');"
response.write"this.location.href='javascript:history.back();'</SCRIPT>"
end sub
%>