DxUpload.RemoveFile(UploadFileInfo) Method
Removes a specific file from the file list.
Namespace: DevExpress.Blazor
Assembly: DevExpress.Blazor.v24.1.dll
NuGet Package: DevExpress.Blazor
Declaration
public void RemoveFile(
UploadFileInfo fileInfo
)
Parameters
Name | Type | Description |
---|---|---|
fileInfo | UploadFileInfo | The file to be removed from the file list. |
Remarks
The following code snippet displays a button that removes the first file from the file list on click.
<DxUpload UploadMode=UploadMode.OnButtonClick
SelectedFilesChanged="@SelectedFilesChanged"
AllowMultiFileUpload="true"
@ref="MyUpload" >
</DxUpload>
<DxButton Text="Remove the First File" Click=OnButtonClick />
@code {
bool UploadVisible { get; set; } = false;
IEnumerable<UploadFileInfo> Files { get; set; }
UploadFileInfo FirstFile { get; set; }
DxUpload MyUpload { get; set; }
protected void SelectedFilesChanged(IEnumerable<UploadFileInfo> files) {
Files = files;
UploadVisible = files.ToList().Count > 0;
InvokeAsync(StateHasChanged);
}
void OnButtonClick(){
FirstFile = Files.First();
MyUpload.RemoveFile(FirstFile);
}
}
To remove the specified files or all files, use the RemoveFiles or RemoveAllFiles method, respectively.
See Also