文件管理

Sub Sure_Click()
        Dim PathString As String
        Dim DirObj As DirectoryInfo
        Dim thepath As String
        thepath = Server.MapPath("/Weboffice/fluxayadmin/youxi/images")
        If Request.QueryString.Get("dir") = "" Then
            PathString = thepath.ToString()
        Else
            PathString = Request.QueryString.Get("dir")
        End If
        DirObj = New System.IO.DirectoryInfo(PathString)
        If DirObj.Exists = False Then
            Response.Write("该文件夹不存在!")
        Else
            DispInfo(PathString)
        End If
    End Sub
    Sub DispInfo(ByVal PathStr As String)
        Dim DirObj As DirectoryInfo
        Dim Arrstr() As DirectoryInfo
        Dim Arrstr1() As FileInfo
        Dim i As Integer
        DirObj = New System.IO.DirectoryInfo(PathStr)
        Response.Write("查看图片文件夹的全部内容")
        Response.Write("点击可以查看图片")
        Response.Write("<p>你现在浏览的目录是:<b>")
        Response.Write(DirObj.FullName.ToString())
        Response.Write("</b></p>")
        Response.Write("该目录创建时间为:<b>")
        Response.Write(DirObj.CreationTime.ToString() & "</b>")
        Response.Write("&nbsp;&nbsp;最后修改时间为:<b>")
        Response.Write(DirObj.LastWriteTime.ToString())
        Response.Write("</b></p>")
        Response.Write("图片文件包括:</p>")
        Response.Write("<table border=0 width=90%>")
        Response.Write("<tr height=30><th width=20%><small>名称</small></th>")
        Response.Write("<th width=15%><small>大小</small></th>")
        Response.Write("<th width=15%><small>类型</small></th>")
        Response.Write("<th width=20%><small>创建时间</small></th>")
        Response.Write("<th width=20%><small>最后修改时间</small></th>")
        Response.Write("<th width=10% align='center'>是否删除</th><tr>")

        Arrstr1 = DirObj.GetFiles()
        For i = 0 To Arrstr1.Length - 1
            Response.Write("<tr>")
            Response.Write("<td><a href='images/")
            Response.Write(Arrstr1(i).Name)
            Response.Write("' target='_blank'>" & Arrstr1(i).Name)
            Response.Write("</a></td>")
            Response.Write("<td align=center><small>" & Arrstr1(i).Length & "字节</small></td>")
            Response.Write("<td align=center><small>" & Arrstr1(i).Extension & "</small></td>")
            Response.Write("<td align=center><small>" & Arrstr1(i).CreationTime.ToString() & "</small></td>")
            Response.Write("<td align=center><small>" & Arrstr1(i).LastWriteTime.ToString() & "</small></td>")
            Response.Write("<td><a href='delpicch.aspx?dir=")
            Response.Write(Arrstr1(i).FullName)
            Response.Write("'>")
            Response.Write("删除")
            Response.Write("</a></td>")
            Response.Write("</tr>")
        Next
        Response.Write("</table>")
    End Sub

   Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        check()
        Dim path As String
        path = Request.QueryString.Get("dir")
        File.Delete(path)
        Response.Write("<script>alert('删除成功');window.location.href='delpic.aspx'</script>")
    End Sub

  • 0
    点赞
  • 0
    评论
  • 0
    收藏
  • 一键三连
    一键三连
  • 扫一扫,分享海报

©️2021 CSDN 皮肤主题: 大白 设计师:CSDN官方博客 返回首页
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、C币套餐、付费专栏及课程。

余额充值