隨筆 - 8  文章 - 55  trackbacks - 0
          <2025年5月>
          27282930123
          45678910
          11121314151617
          18192021222324
          25262728293031
          1234567

          常用鏈接

          留言簿(6)

          隨筆分類

          隨筆檔案

          文章分類

          文章檔案

          朋友的Blog

          最新評論

          閱讀排行榜

          評論排行榜

          asp刪除文件的函數(三個)
          [不指定 2006/04/14 01:06 | by admin ]


          <%
          ''文件刪除函數
          function deletefile(filename)
          if filename<>"" then
          set fso=server.CreateObject("scripting.filesystemobject")
          if fso.FileExists(filename) then
          fso.DeleteFile filename
          else
          Response.Write "<script>alert(''該文件不存在'');</script>"
          end if
          end if
          end function

          strfile=server.MapPath("fileName")
          deletefile(strfile)
          %>





          '程序名:delfile.asp
          '關鍵參數:struploadfiles 文件名稱
          例:<a href="/delfile.asp?action=test.rar">刪除test.rar文件</a>

          <%
          struploadfiles=trim(request.querystring("struploadfiles"))
          action=trim(request.querystring("action"))
          response.write "成功刪除<font color=red>"&struploadfiles&"</font>文件!"
          call delfiles(struploadfiles & "")
          sub delfiles(struploadfiles)
          if struploadfiles="" then exit sub
          dim fso,arruploadfiles,i
          set fso = createobject("scripting.filesystemobject")
          fso.deletefile(server.mappath("" & struploadfiles))
          set fso = nothing
          response.write"<script language=javascript>alert('成功刪除文件,將返回上一頁!');"
          response.write"this.location.href='javascript:history.back();'</script>"
          end sub
          %>





          <%
          ''文件刪除函數
          function deletefile(filename)
          if filename<>"" then
          set fso=server.CreateObject("scripting.filesystemobject")
          if fso.FileExists(filename) then
          fso.DeleteFile filename
          else
          Response.Write "<script>alert(''該文件不存在'');</script>"
          end if
          end if
          end function

          strfile=server.MapPath("fileName")
          deletefile(strfile)
          %>

          Function?DeleFile(FilePath)
          ????On?Error?Resume?Next
          ????Set?Del=Server.CreateObject("Scripting.FileSystemObject")
          ????if?Err?<>?0?Then?
          ????????DelFile="該空間不支持FSO組件,無法刪除文件!"
          ????else
          ????????if?InStr(FilePath,?",")?>?0?then
          ????????????FilePath=Split(FilePath,",")
          ????????????For?i?=?0?to?ubound(FilePath)
          ????????????????If?Del.FileExists(Server.MapPath(FilePath))=True?Then?Del.DeleteFile?Server.MapPath(FilePath(i)),true
          ????????????Next

          ???????Else
          ????????????If?Del.FileExists(Server.MapPath(FilePath))=True?Then?Del.DeleteFile?Server.MapPath(FilePath),true
          ????????End?if
          ????End?if
          ????Set?Del=Nothing
          End?Function


          posted on 2006-06-15 14:10 blog搬家了--[www.ialway.com/blog] 閱讀(1213) 評論(0)  編輯  收藏 所屬分類: PHP
          主站蜘蛛池模板: 宜章县| 深水埗区| 北川| 扎囊县| 莱阳市| 烟台市| 成武县| 横峰县| 湘乡市| 安乡县| 句容市| 韩城市| 耒阳市| 潞城市| 海晏县| 资源县| 太湖县| 临泽县| 邛崃市| 涞水县| 仁寿县| 米脂县| 平潭县| 株洲市| 宜良县| 镶黄旗| 汨罗市| 文昌市| 新竹县| 灵丘县| 新邵县| 从化市| 定边县| 清水县| 革吉县| 留坝县| 北碚区| 寿宁县| 舒兰市| 泾阳县| 上林县|