Skip to main content

DxUpload.PauseFilesUpload(IEnumerable<UploadFileInfo>) Method

Pauses upload of multiple files to the server.

Namespace: DevExpress.Blazor

Assembly: DevExpress.Blazor.v24.2.dll

NuGet Package: DevExpress.Blazor

Declaration

public void PauseFilesUpload(
    IEnumerable<UploadFileInfo> fileInfos
)

Parameters

Name Type Description
fileInfos IEnumerable<UploadFileInfo>

A collection of files whose upload process is paused.

Remarks

If chunk upload is enabled, users can click the pause button to pause file upload. Handle the FileUploadPaused event to respond to this action.

Upload - Pause a File Upload

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

<DxUpload ChunkSize="1000000"
          SelectedFilesChanged="@SelectedFilesChanged" 
          AllowMultiFileUpload="true"
          @ref="MyUpload" >
</DxUpload>

<DxButton Text="Pause Upload of the First 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.PauseFilesUpload(FirstFiles);
    }
}

To pause upload of the specified file or all files, use the PauseFileUpload or PauseAllFilesUpload method, respectively.

See Also