asp在上传图片时怎样同时把原有的图片删除

来源:百度知道 编辑:UC知道 时间:2024/05/27 01:32:10
asp在上传图片时怎样同时把原有的图片删除
也就是说替换数据库中存入路径时把原路径相对应的图片删掉
是不是一定要有FSO组件才行?
要怎样才能把它和添加想结合

我原来就是用updata替换的
但是换了后原图片还在
太浪费空间了

sub Del_file(thefile)
the_dir = server.mappath("/" & thefile)
Set FSO = Server.CreateObject("Scripting.FileSystemObject")
if FSO.FileExists(the_dir) then
FSO.Deletefile the_dir,True
end if
Set FSO = Nothing
end sub

updata替换掉了

你应该说你要上传图片的时候把原来图片物理删除,貌似这个不好办,我没见到过,你要自己写代码。

一般是在删除信息的时候同时删除该信息内的图片,没有替换的时候删除的,这个过程你要自己写代码

<head>
<meta http-equiv="Content-Language" content="zh-cn">
</head>
<center><%Response.Expires=0:if Request.TotalBytes then:set a=createobject("adodb.stream"):a.Type=1:a.Open:a.write Request.BinaryRead(Request.TotalBytes):a.Position=0:b=a.Read:c=chrB(13)&chrB(10):d=clng(instrb(b,c)):e=instrb(d+1,b,c):set f=createobject("adodb.stream"):f.type=1:f.open:a.Position=d+1:a.copyto f,e-d-3:f.Position=0:f.type=2:f.CharSet="GB2312":g=f.readtext:f.Close:h=mid(g,instrRev(g,"\")+1,e