admin_oa_delfile.asp

来自「一个比较完整的企业erp系统」· ASP 代码 · 共 49 行

ASP
49
字号
<!--#include file="../inc/conn.asp"-->
<%
dim action
 action=request("action")
 
if action="delfile" then
 
dim id,filename,filename0,j,path1
 ID=ReplaceBadChar(trim(request("ID")))
filename=replace(trim(request("filename")),"'"," ")
 
'response.write(id)

filename0=split(filename,",")
for j=0 to ubound(filename0)
		   path1=filename0(j)
		   

call delpath(path1)
  dim rs,sql,temp_file,file1
    set rs=Server.CreateObject("ADODB.RECORDSET")
sql="Select oa_id,oa_title,oa_content,oa_author,uploadfiles,filename,filecount,filesize,fileext,oa_updatetime,oa_fruit from [oa_data] where oa_id="&id
          rs.open sql,conn,1,3 
          temp_file=rs("uploadfiles")
		  file1=replace(temp_file,"|"&path1,"") 
		  rs("uploadfiles")=file1
          rs.update
		  rs.close
		  set rs=nothing
'		  response.write(file1)
		next

  response.redirect "admin_oa_modi.asp?oa_id="&id

sub delpath(path)
Set Fs = Server.CreateObject("Scripting.FileSystemObject")
If Fs.FileExists(server.mappath(Path)) Then
Set Os = Fs.GetFile(server.mappath(Path))
Os.Delete
Response.Write Path&"已被删除!<br>"
Else
Response.Write Path&"该不存在!数据已被删除<br>"
End If
end sub

end if

%>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?