System.Web 1.0.5000.0 2.0.0.0 Gtk# is thread aware, but not thread safe; See the <link location="node:gtk-sharp/programming/threads">Gtk# Thread Programming</link> for details. System.Web.UI.HtmlControls.HtmlInputControl System.Web.UI.IPostBackDataHandler System.Web.UI.ValidationProperty("Value") Use the server control to handle uploading binary or text files from a browser client to the server. File upload works with Microsoft Internet Explorer version 3.02 or later. The control is designed to be used only in postback scenarios and not in asynchronous postback scenarios during partial-page rendering. When you use a control inside an control, the file must be uploaded by using a control that is a object for the panel. controls are used to update selected regions of a page instead of updating the whole page with a postback. For more information, see UpdatePanel Control Overview and Partial-Page Rendering Overview. To specify the file to upload, enter the full path to the file (for example, "C:\MyFiles\Test.txt") in the text box of the control. You can also select the file by clicking the Browse button and then locating it in the Choose file dialog box. The property of an control must be set to "multipart/form-data" for this control to work properly. The control does not have a built-in way to post back to the server. To upload the file to the server, use the method of the object contained in the property. This operation is usually done in an event-handling method, such as for a button click. When you use the method of the class, make sure to specify a rooted path (for example, "C:\MyFiles\Test.txt"). The behavior of the method can be specified in the httpRuntime Element (ASP.NET Settings Schema) configuration section with the requireRootedSaveAsPath attribute. The default value of this attribute is true. If you set this attribute to false, then using the method with no path specified will attempt to place the file in the \system32\inetsrv directory. By default, this directory is write-protected; therefore, the file can not be saved there. Make sure to provide write permission for the account used by ASP.NET for the directory where you want to store the file. When uploading large files, use the maxRequestLength attribute of the <httpRuntime> element to increase the maximum allowable file size. A DNS error is generated in the browser when the file exceeds the specified size. You might also receive the following error message when uploading large files: aspnet_wp.exe (PID: 1520) was recycled because memory consumption exceeded 460 MB (60 percent of available RAM). If you encounter this error message, increase the value of the memoryLimit attribute in the <processModel> element of the Machine.config file. For a list of initial property values for an instance of , see the constructor. Allows programmatic access to the HTML <input type= file> element on the server. Constructor Use this constructor to create and initialize a new instance of the class. The following table shows the initial property value for an instance of . Property Initial Value The "file" literal string. Initializes a new instance of the class. 1.0.5000.0 2.0.0.0 Property System.String To be added: an object of type 'string' Use this property to specify the file type that can be uploaded to the server. For example, to restrict the selection to images, set this property to "image/*". Support for this property is browser-dependent. Check your browser to determine whether it supports this property. It is recommended that you use server-side code to ensure that the file is of the expected type. Gets or sets a comma-separated list of MIME encodings used to constrain the file types the user can select. 1.0.5000.0 2.0.0.0 System.ComponentModel.DesignerSerializationVisibility(System.ComponentModel.DesignerSerializationVisibility.Hidden) System.ComponentModel.DefaultValue("") Method 2.0.0.0 System.Boolean The control implements the interface, which has two methods: and . The method is called by the method and always returns false, indicating that the control's state is not managed by the ASP.NET page framework. The method is used primarily by control developers extending the functionality of the control. Processes the postback data for the control. This method always returns false. The key identifier for the control. The collection of all incoming name values. Property System.Int32 To be added: an object of type 'int' Use this property to specify a limit for the number of characters that can be entered for the path to the file to upload. Support for this property is browser-dependent. Check your browser to determine whether it supports this property. Gets or sets the maximum length of the file path for the file to upload from the client computer. 1.0.5000.0 2.0.0.0 System.ComponentModel.DesignerSerializationVisibility(System.ComponentModel.DesignerSerializationVisibility.Hidden) System.ComponentModel.DefaultValue("") Method 1.0.5000.0 2.0.0.0 System.Void If no encoding is specified for the Web page's control, the property is set to "multipart/form-data". Raises the event for the control. An that contains event data. Property System.Web.HttpPostedFile a Browser security restrictions prevent this value from being maintained across multiple requests. Gets access to the uploaded file specified by a client. 1.0.5000.0 2.0.0.0 System.ComponentModel.DesignerSerializationVisibility(System.ComponentModel.DesignerSerializationVisibility.Hidden) System.ComponentModel.DefaultValue("") Method 2.0.0.0 System.Void The control implements the interface, which has two methods: and . The method does not participate in the processing of the control and is included to complete the interface implementation. The method is used primarily by control developers to extend the functionality of the control. Notifies the control that the state of the control has changed. Property System.Int32 To be added: an object of type 'int' Use this property to specify the width of the text box in which to enter the file path. Gets or sets the width of the text box in which the file path is entered. 1.0.5000.0 2.0.0.0 System.ComponentModel.DesignerSerializationVisibility(System.ComponentModel.DesignerSerializationVisibility.Hidden) System.ComponentModel.DefaultValue("-1") Method 1.0.5000.0 2.0.0.0 System.Boolean This member is an explicit interface member implementation. It can be used only when the instance is cast to an interface. For a description of this member, see . true if the control's state has changed as a result of the postback; otherwise, false. The key identifier for the control. The collection of all incoming name values. Method 1.0.5000.0 2.0.0.0 System.Void This member is an explicit interface member implementation. It can be used only when the instance is cast to an interface. For a description of this member, see . Property 1.0.5000.0 2.0.0.0 System.ComponentModel.Browsable(false) System.String To be added. The property retrieves the full path of the file on the client's computer (for example "C:\MyFiles\Test.txt"). This is useful when you need to know where the file is stored on the computer submitting the file. This property is also commonly used to determine the original file name. To get the original file name, parse the value of this property. The property is read-only. If you attempt to assign a value to this property, a is thrown. Gets the full path of the file on the client's computer.