Skip to main content

DxUpload.RemoveFiles(IEnumerable<UploadFileInfo>) Method

Removes the specified files from the file list.

Namespace: DevExpress.Blazor

Assembly: DevExpress.Blazor.v24.1.dll

NuGet Package: DevExpress.Blazor

Declaration

public void RemoveFiles(
    IEnumerable<UploadFileInfo> fileInfos
)

Parameters

Name Type Description
fileInfos IEnumerable<UploadFileInfo>

A collection of files to be removed from the file list.

Remarks

The following code snippet allows users to upload multiple files and displays a button that removes first two files from the file list on click.

<DxUpload UploadMode=UploadMode.OnButtonClick
          SelectedFilesChanged="@SelectedFilesChanged" 
          AllowMultiFileUpload="true"
          @ref="MyUpload" >
</DxUpload>

<DxButton Text="Remove 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.RemoveFiles(FirstFiles);
    }
}

Upload - Remove Files

To remove the specified file or all files from the file list, use the RemoveFile or RemoveAllFiles method, respectively.

See Also