Name
HtmlInputFile
Synopsis
This class represents the HTML <input type=file> tag, which allows the
user to upload a binary or text file. This control is rendered as a text box
with a paired Browse button. The Browse button opens a standard file selection
dialog box. The chosen file is not transmitted until the form is posted to the
server (usually through a submit button). You can then add code in the event
handler of this button to save or otherwise manipulate the file using the PostedFile property,
which provides a System.Web.HttpPostedFile object.
You can use the HtmlInputFile
property to specify a comma-separated list of MIME file types that your control
will accept. You can also change the maximum path length for the filename
(MaxLength) and the
width of the file path text box
(Size). The HtmlForm.Enctype property of
the containing form must be set to “multipart/form-data” to allow file uploads.
Public Class HtmlInputFile : Inherits HtmlInputControl : Implements_ System.Web.UI.IPostBackDataHandler ' Public Constructors Public Sub New() ' Public Instance Properties Public Property Accept As String Public Property MaxLength As Integer Public ReadOnly Property PostedFile As HttpPostedFile Public Property Size As Integer End Class
Hierarchy
System.Object→ System.Web.UI.Control(System.ComponentModel.IComponent, System.IDisposable, System.Web.UI.IParserAccessor, System.Web.UI.IDataBindingsAccessor)→HtmlControl(System.Web.UI.IAttributeAccessor)→HtmlInputControl→ HtmlInputFile(System.Web.UI.IPostBackDataHandler) ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access