程序设计:Flyangel 用到了vb.net c# asp.net xml等 最大特别是核心功能组件化. 特色: 强大的后台管理功能 支持二级分类 支持匿名投稿 超强用户权限设置

源代码在线查看: uploadfile.aspx.vb

软件大小: 1306 K
上传用户: jipigu
关键词: net Flyangel asp xml
下载地址: 免注册下载 普通下载 VIP

相关代码

				Imports System.Configuration
				Imports System.Drawing.Imaging
				Imports flyangel.article.twotipclass
				
				Public Class uploadfile
				    Inherits System.Web.UI.Page
				    Protected WithEvents button_upfile As System.Web.UI.WebControls.Button
				    Protected WithEvents upload_title As System.Web.UI.WebControls.Label
				    Protected WithEvents upload_type As System.Web.UI.WebControls.Label
				    Protected WithEvents inpfileup As System.Web.UI.HtmlControls.HtmlInputFile
				    Protected WithEvents Panel_selectfile As System.Web.UI.WebControls.Panel
				    Protected WithEvents Panel_message As System.Web.UI.WebControls.Panel
				    Protected WithEvents Panel_uploadbutton As System.Web.UI.WebControls.Panel
				    Protected WithEvents Panel_insertbutton As System.Web.UI.WebControls.Panel
				    Protected WithEvents uploadfiletype As System.Web.UI.HtmlControls.HtmlInputHidden
				    Protected WithEvents uploadfileurl As System.Web.UI.HtmlControls.HtmlInputHidden
				    Protected WithEvents uploadfilename As System.Web.UI.HtmlControls.HtmlInputHidden
				    Protected WithEvents error_message As System.Web.UI.WebControls.Label
				
				#Region " Web 窗体设计器生成的代码 "
				
				    '该调用是 Web 窗体设计器所必需的。
				     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("../js/filenotfound.aspx")
				        End If
				
				        If Request.Cookies("UserInfo").Values("Upload_Level")  1 Then
				            Response.Redirect("../js/filenotfound.aspx")
				            Exit Sub
				        End If
				
				        upload_title.Text = "文件上传"
				        upload_type.Text = "支持" & ConfigurationSettings.AppSettings("uploadtype") & "格式文件,大小在" & (ConfigurationSettings.AppSettings("uploadsize") / 1024) & "KB以内"
				        If Not IsPostBack Then
				            Panel_selectfile.Visible = True
				            Panel_uploadbutton.Visible = True
				            Panel_message.Visible = False
				            Panel_insertbutton.Visible = False
				        End If
				
				    End Sub
				
				
				    Private Sub button_upfile_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles button_upfile.Click
				        Dim _postedfile As HttpPostedFile = inpfileup.PostedFile
				        If _postedfile.FileName = "" Then
				            error_message.Text = "错误!"
				            Exit Sub
				        End If
				
				        Dim uploadbool As Boolean = False
				        Dim ifiledo As iFileDoClass = HowToUsingFlyangel.iFileDoClass(ConfigurationSettings.AppSettings("AssemblyFilePath"))
				        ifiledo.SetAllowFileUpLoadSize = ConfigurationSettings.AppSettings("AllowFileUpLoadSize")
				        ifiledo.SetAllowFileUpLoadType = ConfigurationSettings.AppSettings("AllowFileUpLoadTypeB")
				        ifiledo.SetFileUpLoadPath = ConfigurationSettings.AppSettings("FileUpLoadPath")
				
				        Dim _extstring As String = (_postedfile.FileName).Substring(_postedfile.FileName.LastIndexOf(".")).ToLower()
				
				        If _extstring = ".jpg" Or _extstring = ".png" Or _extstring = ".bmp" Or _extstring = ".jpeg" Then
				            ifiledo.SetImageSealFontColor = Color.BlueViolet
				            ifiledo.SetImageSealText = ConfigurationSettings.AppSettings("AddImagesSealText")
				            uploadbool = ifiledo.AddSealTextImages(_postedfile, False, True, False)
				        Else
				            uploadbool = ifiledo.FileUpload(_postedfile)
				        End If
				
				        If Not uploadbool Then
				            error_message.Text = ifiledo.GetUploadFileMessage
				            Panel_message.Visible = True
				            Panel_selectfile.Visible = False
				            Panel_uploadbutton.Visible = False
				            Exit Sub
				        End If
				
				        Dim sFiletype As String
				        sFiletype = ifiledo.Getimagefiletype.Replace(".", "")
				
				        If sFiletype = "gif" Or sFiletype = "jpg" Or sFiletype = "png" Or sFiletype = "bmp" Then
				            uploadfiletype.Value = "img"
				        ElseIf sFiletype = "xml" Then
				            uploadfiletype.Value = "xml"
				        ElseIf sFiletype = "pas" Then
				            uploadfiletype.Value = "pas"
				        Else
				            uploadfiletype.Value = "other"
				        End If
				        Panel_message.Visible = True
				
				        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"), ifiledo.GetUploadFileName & "(大小:" & (ifiledo.GetUploadsize / 1024) & "KB)", Request.UserHostAddress & "-" & Request.UserHostName)
				        error_message.Text = ifiledo.GetUploadFileMessage & " " & ifiledo.GetUploadFileName & "(大小:" & (ifiledo.GetUploadsize / 1024) & "KB)"
				        uploadfileurl.Value = ConfigurationSettings.AppSettings("UpLoadUrl") & ifiledo.GetUploadFileName
				        uploadfilename.Value = ifiledo.GetUploadFileName
				        Panel_selectfile.Visible = False
				        Panel_uploadbutton.Visible = False
				        Panel_insertbutton.Visible = True
				    End Sub
				
				
				End Class
							

相关资源