Skip to main content

ASPxUploadControl.FileUploadComplete Event

Occurs after a file has been uploaded to the server.

Namespace: DevExpress.Web

Assembly: DevExpress.Web.v23.2.dll

NuGet Package: DevExpress.Web


public event EventHandler<FileUploadCompleteEventArgs> FileUploadComplete

Event Data

The FileUploadComplete event's data class is FileUploadCompleteEventArgs. The following properties provide information specific to this event:

Property Description
CallbackData Gets or sets a string that contains specific information (if any) to be passed from the server side to the client.
ErrorText Gets or sets the error text.
IsValid Gets or sets a value specifying whether the uploaded file passes validation.
UploadedFile Gets the uploaded file object related to the event.


The FileUploadComplete event occurs when uploading the specified file has been completed on the server side, initiated either manually (by a call to the ASPxClientUploadControl.Upload method) or automatically (on the next round trip to the server, as on a button click or page refresh). Handle the FileUploadComplete event to perform specific server operations after the specified file has been uploaded.

View Example: Upload Control for ASP.NET Web Forms - How to upload an image and display it on a web page

The FileUploadComplete event allows you to verify whether the uploaded file passes the required validation criteria (if any are defined by using the ASPxUploadControl.ValidationSettings property or writing custom code logic), and save the file to a specific server location (using, for instance, the UploadedFile.SaveAs method).

When the UploadMode property is set to Standard, the event is raised after a file is uploaded to the server. If the UploadMode property is set to Advanced, the event is raised when all selected files are uploaded to the server.

Note that if the file upload was initiated by the client ASPxClientUploadControl.Upload method, and the FileUploadComplete event is handled during callback processing, you can use the event’s FileUploadCompleteEventArgs.CallbackData property to pass any additional information to the client for further processing in a handler of the ASPxClientUploadControl.FileUploadComplete client event.


The ASPxUploadControl aborts request execution when a file is uploaded, so some your code cannot be executed. This behavior is by design and depends on the ASPxUploadControl.FileUploadMode property value and control creation approach (markup or runtime). See the Page Life Cycle During File Upload topic for more details.


The following sample code demonstrates how to save the file specified within the ASPxUploadControl on the client. Before file saving, the FileUploadCompleteEventArgs.IsValid property is tested to verify whether the file passes the validation criteria defined via the ASPxUploadControl.ValidationSettings property. Note, that in order to compose the ASPxUploadControl.SaveAs method’s parameter value, the HostingEnvironment.MapPath(String) method and ASPxUploadControl.FileName property are used to specify the web application’s Image folder as a location where the file should be saved and define the file’s name, respectively.

protected void ASPxUploadControl1_FileUploadComplete(object sender, 
DevExpress.Web.FileUploadCompleteEventArgs e) {
    if (e.IsValid) {
        e.UploadedFile.SaveAs(MapPath("Images/" + e.UploadedFile.FileName));
See Also