蓝森林首页 | 返回主页 | 本站地图 | 站内搜索 | 联系信箱 |
 您目前的位置:首页 > 自由软件 > 技术交流 > 应用编程


    

蓝森林 http://www.lslnet.com 2006年8月25日 8:28

[asp]如何实现删除上传文件!

谢谢个位!

FSO

不明白,给个相关帖子的地址可以吗??

set objFS=Server.CreateObject("Scripting.FileSystemObject")
' address 是相对路径,phyPath就是要删文件的绝对路径
phyPath=Server.MapPath(address)
' 判断文件是否存在
if objFS.FileExists(phyPath) then
' 删除文件,True 表示只读的也删除
   objFS.DeleteFile phyPath,True
end if

set objFS=nothing

楼上所写的在什么地方可以找到相关资料啊,我想看看这部分内容。它是不是属于服务器对象啊。

网上多的 你搜 FileSystemObject 或 FSO

下面这段代码送你好了!


-----------------------------------------------------------------

<!-- #include file="../inc/conn.asp"-->
<%
set rs=server.CreateObject("adodb.recordset")
sql="select * from product where id="&request("id")
rs.open sql,conn,1,3
conn.execute "delete * from images where imapath='"&rs("prosimg")&"'"
conn.execute "delete * from images where imapath='"&rs("probimg")&"'"
  path= server.mappath(rs("prosimg"))
  path1=server.MapPath(rs("probimg"))
  set objfso = server.createobject("scripting.FileSystemObject")
                 if objfso.FileExists(path) then
                       objfso.DeleteFile(path)      
                end if
                 if objfso.FileExists(path1) then
                                   objfso.DeleteFile(path1)      
                end if
                                set objfso = nothing
conn.execute "delete * from product where id="&request("id")
response.Redirect("main.asp")
%>

----------------------------------------------------------------------------

呵呵,我正找这个呢

提醒:最后回贴距现在596天,请不要无意义回复;);)




Copyright © 1999-2000 LSLNET.COM. All rights reserved. 蓝森林网站 版权所有。 E-mail : webmaster@lslnet.com