我的世界故事模式1 8:用ASP删除指定文件名的图片
来源:百度文库 编辑:杭州交通信息网 时间:2024/05/08 03:06:48
我是这么用的,你参考下吧。
filepath=Trim(Request.Form("filepath"))
if filepath="" then
response.write("<div>请输入要删除文件的地址 [ <a href=# onclick=history.go(-1)>重新输入</a> ]</div>")
response.end
end if
filepath=replace(filepath,",","")
'这里的地址为相对地址,要根据实际情况修改一下,你自己看着办
'去掉一些非法字符,要不会引起错误!
Set deleteFileObject=Server.CreateObject("Scripting.FileSystemObject")
delefilepath=Server.MapPath(filepath)
if deleteFileObject.FileExists(delefilepath) then
Response.Write("<div>存在这个文件")
Set delefilepath=deleteFileObject.GetFile(delefilepath)
delefilepath.Delete
Response.Write(",文件已经被删除!!")
Response.Write("[ <a href=# onclick=history.go(-1)>继续删除</a> ]</div>")
else
Response.Write("不存在这个文件")
Response.Write("<div>[ <a href=# onclick=history.go(-1)>重新输入</a> ]</div>")
end if
到ftp去操作呀
要使用 FSO的,网站有文件上传都应该加一个文件删除功能,不然暴死你!