Asp.net| Upload | Design |asp.net| upload this version and the simple front of the class is like a function, but the front end of the code to split the
' この call び out しはwebフォームデザイナで necessary です.
<system.diagnostics.debuggerstepthrough () > Private Sub InitializeComponent ()
End Sub
Protected WithEvents Fileuploadform as System.Web.UI.WebControls.Panel
Protected WithEvents FileName as System.Web.UI.WebControls.Label
Protected WithEvents Filelength as System.Web.UI.WebControls.Label
Protected WithEvents FileType as System.Web.UI.WebControls.Label
Protected WithEvents answermsg as System.Web.UI.WebControls.Panel
Protected WithEvents Lofile as System.Web.UI.HtmlControls.HtmlInputFile
Protected WithEvents Button1 as System.Web.UI.WebControls.Button
Protected WithEvents dir as System.Web.UI.WebControls.TextBox
' メモ: のプレースホルダ declaration はwebフォームデザイナで necessary です.
' Removes the および movement しないでください.
Private Designerplaceholderdeclaration as System.Object
Private Sub Page_Init (ByVal sender as System.Object, ByVal e as System.EventArgs) Handles Mybase.init
' codegen:このメソッド call び out しはwebフォームデザイナで necessary です.
' コードエディタを makes って becomes more しないでください.
InitializeComponent ()
End Sub
#End Region
Private Sub Page_Load (ByVal sender as System.Object, ByVal e as System.EventArgs) Handles MyBase.Load
' ページを initial するユーザーコードをここに 挿 into します.
End Sub
Private Sub button1_click (ByVal sender as System.Object, ByVal e as System.EventArgs) Handles Button1.Click
Dim Lstrfilename as String
Dim Lstrfilenamepath as String
Dim Lstrfilefolder as String
If dir. Text <> "Then ' If the registration is empty, use" c:\ "As the default of the traditional registration
Lstrfilefolder = dir. Text ' Get the name of the registration that was uploaded to the service
Else
Lstrfilefolder = "C:\"
End If
Dim files as System.Web.HttpFileCollection = System.Web.HttpContext.Current.Request.Files
Dim PostedFile as System.Web.HttpPostedFile = files (0)
Lstrfilename = System.IO.Path.GetFileName (postedfile.filename) ' Got the filename
' Note: LoFile.PostedFile.FileName returns the file name that is selected through the file dialog box, which contains the document's target registration information
if (not directory.exists (lstrfilefolder)) Then ' judge whether the presence of the registration or not exists, it is established
Directory.CreateDirectory (Lstrfilefolder)
End If
Lstrfilenamepath = lstrfilefolder & Lstrfilename ' upload files to the service
LoFile.PostedFile.SaveAs (Lstrfilenamepath) ' Get the name of registration and file
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.