Admin/FileEdit.aspx.vb

(完整代码) 1KB

Imports System.IO
Imports System.Data

Partial Class Admin_FileEdit
    Inherits System.Web.UI.Page


    Dim tmpData As New DataControl

    Protected Sub Button2_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button2.Click
        '判断信息是否正确
        If Me.TextBox1.Text.Trim() = "" Then
            TErr.InnerHtml = "<font color='red'>主题不能为空</font>"
            Exit Sub
        End If
        '将相关的图片上传到@"Pic\"路径下
        Dim FileName As String = ""
        Dim FileName1 As String
        Dim DPath As String
        If Server.MapPath("").Substring(Server.MapPath("").Length - 1, 1) = "\" Then
            DPath = Server.MapPath("")
        Else
            DPath = Server.MapPath("") + "\"
        End If
        DPath = DPath + "File\"
        If File1.PostedFile.FileName <> "" Then
            Dim temp() As String = Me.File1.PostedFile.FileName.Split(".")
            Dim strHzm As String = "." + temp(temp.Length - 1)
            Dim tmp As Guid = Guid.NewGuid()
            FileName = tmp.ToString() & strHzm
            FileName1 = DPath + tmp.ToString() & strHzm
            File1.PostedFile.SaveAs(FileName1)
        End If
        '根据标志判断是添加还是修改的操作 保存文件信息
        tmpData.ExecSql("insert into 文件(文件名,文件,内容介绍) values('" & Me.TextBox1.Text.Trim() & "','" & FileName & "','" & Me.Textbox3.Text.Trim() & "')")
        Response.Redirect("FileList.aspx")
    End Sub

    Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
        '跳转页面
        Response.Redirect("FileList.aspx")
    End Sub

End Class

24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明

AI 解读 AI

登录后可用,每次 10 积分,解读结果公开显示在下面。

还没有人解读过这个文件。