很急,一个关于ASP删除图片物理路径的问题

来源:百度知道 编辑:UC知道 时间:2024/06/28 02:06:04
我今天在网上搜了一体段代码;
<%
action=request.QueryString("action")
response.Write action

%>
<script language="javascript">
Function FSOdel(fileName)
dim fso,f
set fso = server.CreateObject( "scripting.filesystemobject ")
f=server.MapPath(&action&)
if fso.FileExists(f) then
fso.DeleteFile f,true
end if
set f = nothing
set fso = nothing
End Function
</script>

这是不是把图片的路径获取过来,然后在11行那个地方填上这个变量(图片的路径)就可以了,我不知道那样填上去对不对,有一些是我加的,我要怎么改才能删除空间里的图片啊,知道的大哥告诉我一下,或有好的发出来共享一下,我不太懂ASP..
filename1="../"&request("name2")&".htm"/删除文章路径,换成图片的路径就可以了 这个地方是写图片的路径吗??但是你怎么用request的啊

fso.deletefile(server.mappath(""&filename1&""))/执行删除 那这个地方,filename是什么呀,

楼主直接用这个就OK了,URL 是获取过来的路径,ID是该图片在数据库保存的ID包括URL地址。这样可以直接删物理路径下的图片。
<%
action=request.QueryString("action")
%>
<%
select case action
case "delimg"

id=request.QueryString("id")
url=request.QueryString("url")
conn.execute("delete * from adv where id="&id)
Set fso = CreateObject("Scripting.FileSystemObject")
Set f2 = fso.getfile(server.mappath(url))
f2.delete
set fso=nothing
set f2=nothing
response.Redirect("adv.asp")
response.End()

%>

filename就是图片路径
楼主己写好了,直接调用就行了
调用时:call FSOdel("../img/01.jpg")
删除<script language="javascript">
直接用:
Function FSOdel(fileName)
dim fso,f
set fso = server.CreateObject( "scripting.filesystemobject ")
f=server.MapPath(&action&)
if fso.FileExists(f) then
fso.DeleteFile f,