Back to Devexpress

DxUpload.FileUploadStarted Event

blazor-devexpress-dot-blazor-dot-dxupload-515a0ff0.md

latest2.1 KB
Original Source

DxUpload.FileUploadStarted Event

Fires when the file upload starts.

Namespace : DevExpress.Blazor

Assembly : DevExpress.Blazor.v25.2.dll

NuGet Package : DevExpress.Blazor

Declaration

csharp
[Parameter]
public EventCallback<FileUploadEventArgs> FileUploadStarted { get; set; }

Event Data

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

PropertyDescription
FileInfoReturns information about a file.

Remarks

The FileUploadStart event fires when file upload is about to start. In Instant upload mode, the FileUploadStart event occurs when a user selects a file in the Open File dialog or drops a file onto the drop zone. In OnButtonClick upload mode, this event fires when a user clicks the upload button.

If the file upload operation is not cancelled in the FileUploadStart event, the FileUploadStarted event occurs.

razor
<DxUpload Name="myFile" UploadUrl="https://localhost:10000/api/Upload/Upload/" 
          FileUploadStarted="@OnFileUploadStarted">
</DxUpload>
<div class="alert alert-info @(MessageVisible? " visible" : " invisible")">@MyMessage</div>

@code {
    bool MessageVisible { get; set; } = false;
    string MyMessage { get; set; } = "";

    void OnFileUploadStarted(FileUploadEventArgs e) {
        MyMessage = "Upload of the " + e.FileInfo.Name + " file was started.";
        MessageVisible = true;
        InvokeAsync(StateHasChanged);
    }
}

See Also

DxUpload Class

DxUpload Members

DevExpress.Blazor Namespace