Skip to main content
All docs
V25.1
  • DxUpload.CancelFilesUpload(IEnumerable<UploadFileInfo>) Method

    Cancels upload of multiple files displayed in the Upload component.

    Namespace: DevExpress.Blazor

    Assembly: DevExpress.Blazor.v25.1.dll

    NuGet Package: DevExpress.Blazor

    Declaration

    public void CancelFilesUpload(
        IEnumerable<UploadFileInfo> fileInfos
    )

    Parameters

    Name Type Description
    fileInfos IEnumerable<UploadFileInfo>

    A collection of files whose upload is cancelled.

    Remarks

    When file upload is in progress, users can click the cancel button to interrupt file upload. Handle the FileUploadAborted event to respond to this action.

    Upload - Cancel File Upload

    Use the CancelFilesUpload method to cancel specific files upload in code. The snippet below allows users to upload multiple files and displays a button that cancels upload of the first two files on click.

    <DxUpload UploadMode=UploadMode.OnButtonClick
              SelectedFilesChanged="@SelectedFilesChanged" 
              AllowMultiFileUpload="true"
              @ref="MyUpload" >
    </DxUpload>
    
    <DxButton Text="Cancel Upload of Two Files" Click=OnButtonClick />
    
    @code {
        bool UploadVisible { get; set; } = false;
        IEnumerable<UploadFileInfo> Files { get; set; }
        IEnumerable<UploadFileInfo> FirstFiles { get; set; }
        DxUpload MyUpload { get; set; }
    
        protected void SelectedFilesChanged(IEnumerable<UploadFileInfo> files) {
            Files = files;
            UploadVisible = files.ToList().Count > 0;
    
            InvokeAsync(StateHasChanged);
        }
    
        void OnButtonClick(){
            FirstFiles = Files.Take(2);
            MyUpload.CancelFilesUpload(FirstFiles);
        }
    }
    

    To cancel upload of the specified file or all files, use the CancelFileUpload or CancelAllFilesUpload method, respectively.

    To reload the file(s) whose upload was canceled, use the following methods:

    See Also