If the size of the file to upload is less than 2 MB, the Save As method is called to save the file to the specified path on the server.In addition to checking for the maximum file size setting in your application code, you can set the The following example demonstrates how to create a File Upload control that saves files to a path that is specified in the code.The code that you write to save the specified file should call the Save As method, which saves the contents of a file to a specified path on the server.
However, the same functionality is provided by the File Name property, the File Content property, and the Save As method.The File Upload control does not automatically save a file to the server after the user selects the file to upload.This example allows only files that have the or file name extensions to be uploaded. Get Extension method is called to return the extension of the file to upload.If the file has a or file name extension, the Save As method is called to save the file to the specified path on the server.The file name that this property returns does not include the path of the file on the client.
The File Content property gets a Stream object that points to a file to upload.
You can use this property to access additional properties on the file.
The Content Length property gets the length of the file.
The File Upload class displays a text box control and a browse button that enable users to select a file on the client and upload it to the Web server.
The user specifies the file to upload by entering the full path of the file on the local computer (for example, C:\My Files\Test File.txt) in the text box of the control.