asp删除文件的函数(三个)

| |
[不指定 2006/04/14 01:06 | by admin ]


<%
''文件删除函数
function deletefile(filename)
if filename<>"" then
set fso=server.CreateObject("scripting.filesystemobject")
if fso.FileExists(filename) then
fso.DeleteFile filename
else
Response.Write "<script>alert(''该文件不存在'');</script>"
end if
end if
end function

strfile=server.MapPath("fileName")
deletefile(strfile)
%>





'程序名: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
%>





<%
''文件删除函数
function deletefile(filename)
if filename<>"" then
set fso=server.CreateObject("scripting.filesystemobject")
if fso.FileExists(filename) then
fso.DeleteFile filename
else
Response.Write "<script>alert(''该文件不存在'');</script>"
end if
end if
end function

strfile=server.MapPath("fileName")
deletefile(strfile)
%>







关于上面这个函数!不能做到删除某种类型的文件,或是,我们自己定义的权限!

作者:Else 's Blog
地址:http://www.aixq.com/post/89/
版权所有。转载时必须链接形式注明作者和原始出处及本声明!
  • 中查看更多“asp删除文件的函数(三个)”相关内容
  • 中查看更多“asp删除文件的函数(三个)”相关内容
  • 中查看更多“asp删除文件的函数(三个)”相关内容
  • 中查看更多“asp删除文件的函数(三个)”相关内容
  • 中查看更多“asp删除文件的函数(三个)”相关内容
  • 中查看更多“asp删除文件的函数(三个)”相关内容

  • 最后编辑: admin 编辑于2006/04/14 01:19
    Tags: ,
    代码 程序 编程 | 评论(0) | 引用(0) | 阅读(3344)
    发表评论
    表情
    emotemotemotemotemot
    emotemotemotemotemot
    emotemotemotemotemot
    emotemotemotemotemot
    emotemotemotemotemot
    打开HTML
    打开UBB
    打开表情
    隐藏
    昵称   密码   游客无需密码
    网址   电邮   [注册]
                   

    验证码 不区分大小写