Name

HttpPostedFile

Synopsis

The HttpPostedFile class allows you to easily manipulate files that are uploaded by the client. An HttpPostedFile instance is provided by the PostedFile property of the System.Web.UI.HtmlControls.HtmlInputFile control.

You can use the SaveAs() method to save a posted file to disk synchronously. The method will return once the file is completely uploaded. Alternatively, you can get a System.IO.Stream object containing the file from the InputStream property and use it to work with the file asynchronously (while it is being uploaded).

Public NotInheritable Class HttpPostedFile
                  ' Public Instance Properties
   Public ReadOnly Property ContentLength As Integer  
   Public ReadOnly Property ContentType As String  
   Public ReadOnly Property FileName As String  
   Public ReadOnly Property InputStream As Stream  
' Public Instance Methods
   Public Sub SaveAs(ByVal filename As String) 
End Class

Get ASP.NET in a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.