AsyncFileUpload Demonstration
Click '
Select File' for asynchronous uploading.
The latest Server-side event:
Client-side events:
AsyncFileUpload is an ASP.NET AJAX Control that allows you asynchronously upload files to server.
The file uploading results can be checked both in the server and client sides.
You can save the uploaded file by calling the SaveAs() method in a handler for the
server UploadedComplete event.
The control above is initialized with this code. The italic properties
are optional:
<ajaxToolkit:AsyncFileUpload OnClientUploadError="uploadError"
OnClientUploadComplete="uploadComplete" runat="server"
ID="AsyncFileUpload1" Width="400px" UploaderStyle="Modern"
UploadingBackColor="#CCFFFF" ThrobberID="myThrobber"
/>
Events
- UploadedComplete - Fired on the server side when the file
successfully uploaded
- UploadedFileError - Fired on the server side when the uloaded file
is corrupted
Properties
- CompleteBackColor - The control's background color on upload complete.
Default value - 'Lime'.
- ContentType - Gets the MIME content type of a file sent by a client.
- ErrorBackColor - The control's background color on upload error.
Default value - 'Red'.
- FileContent - Gets a Stream object that points to an uploaded file to prepare for reading the contents of the file.
- FileName - Gets the name of a file on a client to upload using the control.
- HasFile - Gets a bool value indicating whether the control contains a file.
- OnClientUploadComplete - The name of a javascript function executed
in the client-side after the file successfully uploaded
- OnClientUploadError - The name of a javascript function executed
in the client-side if the file uploading failed
- OnClientUploadStarted - The name of a javascript function executed
in the client-side on the file uploading started
- PostedFile - Gets a HttpPostedFile object that provides access to the uploaded file.
- ThrobberID - ID of control that is shown while the file is uploading.
- UploaderStyle - The control's appearance style (Traditional, Modern).
Default value - 'Traditional'.
- UploadingBackColor - The control's background color when uploading is in progress.
Default value - 'White'.
- Width - The control's width (Unit).
Default value - '355px'.
Methods
- SaveAs(string filename) - Saves the contents of an uploaded file.