upload.aspx.vb

来自「程序设计:Flyangel 用到了vb.net c# asp.net xml等 」· VB 代码 · 共 96 行

VB
96
字号
Imports System.Configuration
Imports flyangel.article.twotipclass


Public Class upload
    Inherits System.Web.UI.Page
    Protected WithEvents button_upfile As System.Web.UI.WebControls.Button
    Protected WithEvents inpfileup As System.Web.UI.HtmlControls.HtmlInputFile
    Protected WithEvents Panel_uploadbutton As System.Web.UI.WebControls.Panel
    Protected WithEvents Panel_insertbutton As System.Web.UI.WebControls.Panel
    Protected WithEvents Image1 As System.Web.UI.WebControls.Image
    Protected WithEvents error_message As System.Web.UI.WebControls.Label
    Protected WithEvents uploadfileurl As System.Web.UI.HtmlControls.HtmlInputHidden
    Protected WithEvents Panel_selectfile As System.Web.UI.WebControls.Panel
    Protected WithEvents Panel_message As System.Web.UI.WebControls.Panel

#Region " Web 窗体设计器生成的代码 "

    '该调用是 Web 窗体设计器所必需的。
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()

    End Sub

    Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
        'CODEGEN: 此方法调用是 Web 窗体设计器所必需的
        '不要使用代码编辑器修改它。
        InitializeComponent()
    End Sub

#End Region

    Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        '在此处放置初始化页的用户代码()
        Dim dpfly As iUserClass = HowToUsingFlyangel.iUserClass(ConfigurationSettings.AppSettings("AssemblyFilePath"))
        dpfly.SetDBConnstring = ConfigurationSettings.AppSettings("ConnstringB")

        If Not dpfly.GetUserLoginCheck() Then
            Response.Redirect("filenotfound.aspx")
        End If

        If Request.Cookies("UserInfo").Values("Upload_Level") <> 1 Then
            Response.Redirect("filenotfound.aspx")
            Exit Sub
        End If
        If Application("uploadFlag") <> 1 Then
            Response.Redirect("filenotfound.aspx")
            Exit Sub
        End If
        Panel_selectfile.Visible = True
        Panel_uploadbutton.Visible = True
        Panel_message.Visible = False
        Panel_insertbutton.Visible = False

    End Sub


    Private Sub button_upfile_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles button_upfile.Click

        If inpfileup.PostedFile.FileName = "" Then
            error_message.Text = "错误!"
            Exit Sub
        End If
        Dim uploadbool As Boolean = False
        Dim ifimage As iFileDoClass = HowToUsingFlyangel.iFileDoClass(ConfigurationSettings.AppSettings("AssemblyFilePath"))
        ifimage.SetImageSealText = ConfigurationSettings.AppSettings("AddImagesSealText")
        ifimage.SetImageSealFontColor = Color.BlueViolet
        ifimage.SetAllowFileUpLoadSize = ConfigurationSettings.AppSettings("AllowFileUpLoadSize")
        ifimage.SetAllowFileUpLoadType = ConfigurationSettings.AppSettings("AllowFileUpLoadTypeA")
        ifimage.SetFileUpLoadPath = ConfigurationSettings.AppSettings("FileUpLoadPath")

        uploadbool = ifimage.AddSealTextImages(inpfileup.PostedFile, True, True, False)

        If Not uploadbool Then
            error_message.Text = ifimage.GetUploadFileMessage
            Panel_message.Visible = True
            Panel_selectfile.Visible = False
            Panel_uploadbutton.Visible = False
            Exit Sub
        End If

        Panel_message.Visible = True
        error_message.Text = ifimage.GetUploadFileMessage
        Image1.ImageUrl = ConfigurationSettings.AppSettings("UpLoadUrl") & ifimage.GetUploadFileName

        Dim dplog As iSystemClass = HowToUsingFlyangel.iSystemClass(ConfigurationSettings.AppSettings("AssemblyFilePath"))
        dplog.SetLogXmlDocument = ConfigurationSettings.AppSettings("eventxml")
        dplog.SetLogXmlSchema = ConfigurationSettings.AppSettings("logxsd")

        dplog.Log_Add_cache("上传文件", Request.Cookies("UserInfo").Values("UserName"), ifimage.GetUploadFileName & "(大小:" & (ifimage.GetUploadsize / 1024) & "KB)", Request.UserHostAddress & "-" & Request.UserHostName)
        uploadfileurl.Value = ConfigurationSettings.AppSettings("uploadurl") & ifimage.GetUploadFileName
        Panel_selectfile.Visible = False
        Panel_uploadbutton.Visible = False
        Panel_insertbutton.Visible = True
    End Sub
End Class

⌨️ 快捷键说明

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