System.Web.UI.HtmlControls (system.web.dll)class

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. You can limit the maximum size of file uploads using the maxRequestLength setting in the web.config file. By default, file uploads larger than 4096 KB will not be allowed.

public class HtmlInputFile : HtmlInputControl, System.Web.UI.IPostBackDataHandler {
// Public Constructors
   public HtmlInputFile( );
// Public Instance Properties
   public string Accept{set; get; }
   public int MaxLength{set; get; }
   public HttpPostedFile PostedFile{get; }
   public int Size{set; get; }
   public override string Value{set; get; }         // overrides HtmlInputControl
// Protected Instance Methods
   protected override void OnPreRender(EventArgs e);            // overrides System.Web.UI.Control


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)

    Part I: Introduction to ASP.NET
    Part III: Namespace Reference
    Chapter 40. The System.Web.UI.MobileControls Namespace
    Chapter 42. The System.Web.UI.WebControls Namespace