Skip to main content

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

DxUpload.FileUploadError Event

Fires if an error occurs during file upload.

Namespace: DevExpress.Blazor

Assembly: DevExpress.Blazor.v24.2.dll

NuGet Package: DevExpress.Blazor

#Declaration

C#
[Parameter]
public EventCallback<FileUploadErrorEventArgs> FileUploadError { get; set; }

#Event Data

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

Property Description
FileInfo Returns information about a file. Inherited from FileUploadEventArgs.
RequestInfo Returns information about a request’s response.

#Remarks

The FileUploadError event occurs if a file was not uploaded to the server because of an error. If a file was uploaded successfully, the FileUploaded event occurs.

The following snippet handles the FileUploadError event and shows a custom error message that is passed from the server.

<DxUpload Name="myFile" UploadUrl="https://localhost:10000/api/Upload/UploadFile/"
          FileUploadError="@OnUploadError">
</DxUpload>
<div class="alert alert-danger @(ErrorVisible? " visible" : " invisible")">@MyError</div>

@code {
    bool ErrorVisible { get; set; } = false;
    string MyError { get; set; }

    void OnUploadError(FileUploadErrorEventArgs e) {
        MyError = e.RequestInfo.ResponseText;
        ErrorVisible = true;
        InvokeAsync(StateHasChanged);
    }
}

File Upload Error

See Also