DwsFileUpload
A drop zone with a file list. The whole zone is a tap target that opens the file picker; on a phone a “Take photo” button opens the camera, and a finished or failed upload plays a haptic when the app switches haptics on.
API ReferenceInterface-Description
| Name | Typ | Parameters | Description |
|---|---|---|---|
| PauseUpload(Guid / DwsFileUploadItem) | void | Pauses a running chunked upload: the chunk on its way is finished, then the file is Paused. | |
| ResumeUploadAsync(Guid / DwsFileUploadItem) | Task | Continues a paused chunked upload with the first chunk that was not acknowledged. | |
| ResetSelection() | Task | Clears the current selection and any in-flight upload state. | |
| ShowPicker() | Task | Programmatically opens the native file picker dialog. | |
| ShowFolderPicker() | Task | Programmatically opens the native folder picker dialog (requires AllowFolderUpload). | |
| UploadFileAsync(Guid) | Task | Uploads a single file identified by its Id, delegating I/O to OnFileUpload. | |
| UploadFileAsync(DwsFileUploadItem) | Task | Uploads a single file, delegating I/O to OnFileUpload. | |
| UploadAllAsync() | Task | Uploads every file currently in the Pending state. | |
| CancelUpload(Guid / DwsFileUploadItem) | void | Cancels the running upload of one file: its CancellationToken is signalled and the file ends up Canceled (pass the token to your stream reads). The row shows the same cancel button while uploading; a cancelled file can be started again. | |
| ClearRejectedFiles | Task | Removes every rejected file from the list at once and raises OnFileRemoved for each. While something is dragged over the drop zone that it will not take (no file, or a type outside Filter), the zone already shows it (red border, no-drop cursor). |
| Name | Typ | Default | Description |
|---|---|---|---|
| Multiple | bool | true | Allows selecting more than one file at a time. |
| Filter | string? | null | Comma-separated allowed file type(s)/extension(s), mapped to the accept attribute and re-checked in code. |
| MaxFileSize | long? | null | Maximum allowed file size in bytes; larger files are rejected on selection. |
| MaxFileCount | int? | null | The most files the list accepts. A file selected beyond it is added as rejected with a localised reason and OnFileRejected is raised. Rejected and canceled entries do not count; removing a file frees its place. Values below 1 are ignored. |
| MaxTotalSize | long? | null | The most bytes all files of the list may have together. A file that would exceed it is added as rejected with a localised reason and OnFileRejected is raised. Rejected and canceled entries do not count. Values below 1 are ignored. |
| Mode | DwsFileUploadMode | UserInteraction | Instant uploads automatically on selection; UserInteraction waits for an explicit upload trigger. |
| ViewMode | DwsFileUploadViewMode | List | List renders files inline; Dropdown collapses them behind a compact trigger. |
| DisableProgressReport | bool | false | Hides the per-file progress bar/percentage. |
| AllowFolderUpload | bool | false | Renders an additional folder-picker trigger (webkitdirectory). |
| AllowDuplicates | bool | false | When false, a file already pending or uploading (same name, path, size, last-modified) is added as Rejected instead of a second copy. |
| FormFieldName | string? | null | Under static SSR the component renders a native file input with this name (posted by a DwsForm with Multipart); without it a notice says the upload needs interactivity. |
| DropzoneText | string? | null | Override for the drop-zone instructional text. |
| Appearance | DwsAppearance | Filled | Visual appearance of the action buttons. |
| Color | DwsColor | Primary | Theme color of the action buttons and dropzone accents. |
| ButtonSize | DwsSize | Medium | Size of the action buttons. |
| FileTemplate | RenderFragment<DwsFileUploadItem>? | null | Custom rendering for a single file entry. |
| ButtonsTemplate | RenderFragment<DwsFileUploadItem>? | null | Custom rendering for a file entry's action buttons. |
| ValidationCallback | Func<DwsFileUploadItem, Task<DwsFileUploadValidationResult>>? | null | Custom validation evaluated after the built-in size/filter checks pass. |
| ChunkSize | int? | null | Size of a chunk in bytes. Together with OnChunkUpload it switches the upload to chunks: it can be paused, and a failed or canceled upload continues with the first chunk that was not acknowledged. |
| ShowPauseButton | bool | true | Shows a pause button in the row of a running chunked upload, and a resume button once it is paused. |
| ShowThumbnails | bool | true | Shows a small preview in the row of an image file (image/*, up to 25 MB) in place of the file icon. The preview is an object URL created and revoked in the browser. |
| AllowPaste | bool | true | Adds files pasted from the clipboard (Ctrl+V) while the focus is inside the component, as if they had been dropped, and announces it. |
| AllowCameraCapture | bool | true | Shows a “Take photo” button on touch screens that opens the camera (capture) instead of the file picker, while Filter admits images or is not set. A tap anywhere on the drop zone opens the file picker. |
| PlayHaptics | bool | true | Plays a success haptic when the uploads have finished without a failure and an error haptic when a file fails or is rejected, while the app has haptics on (IDwsHapticService). |
| Variant | DwsFileUploadVariant | Dropzone | Dropzone: icon, hint and buttons. Compact: one slim row. Button: the Browse button alone. Avatar: a round image tile with a camera badge (ImageSrc, AvatarSize), file list hidden. Every variant takes dropped and pasted files. |
| TriggerTemplate | RenderFragment<DwsFileUploadTriggerContext>? | null | Your own content in place of the drop zone's. The context has BrowseAttributes / CameraAttributes (spread them on the element that opens the picker, in the tap), Browse(), CanUseCamera, IsDragOver, Disabled and Items. |
| ShowFileList | bool? | null | Shows the list (or dropdown) of picked files. Null: shown, except for the Avatar variant. |
| ShowDropzoneIcon | bool | true | Shows the drop zone's icon (Dropzone variant). |
| ShowDropzoneText | bool | true | Shows the hint text (Dropzone and Compact variants). |
| DropzoneIcon | string? | null | The drop zone's icon; null is a cloud with an arrow. |
| BrowseButtonText | string? | null | The Browse button's text; null is the localised "Browse". |
| BrowseButtonIcon | string? | null | An icon before the Browse button's text. |
| ImageSrc | string? | null | Avatar variant: the current picture, shown until an image is picked (then its preview). |
| AvatarSize | int? | null | Avatar variant: the tile's size in pixels (96 when null). |
| Name | Typ | Description |
|---|---|---|
| OnChunkUpload | EventCallback<DwsFileUploadChunkEventArgs> | Uploads one chunk: File, Offset, Length, Content (a stream of exactly Length bytes), Index, TotalChunks, IsLastChunk, CancellationToken. Returning acknowledges the chunk; throwing fails the file. |
| OnFileUploadPaused | EventCallback<DwsFileUploadItem> | Raised when a chunked upload has stopped after an acknowledged chunk because it was paused. |
| OnFileUploadResumed | EventCallback<DwsFileUploadItem> | Raised when a paused, failed or canceled chunked upload continues from its acknowledged bytes (DwsFileUploadItem.UploadedBytes). |
| SelectedFilesChanged | EventCallback<List<DwsFileUploadItem>> | Fired whenever the current selection changes. |
| OnFileUpload | EventCallback<DwsFileUploadEventArgs> | Fired to actually perform the upload of a single file; the consumer owns the real I/O. |
| OnFileUploadStarted | EventCallback<DwsFileUploadItem> | Fired when a file's upload begins. |
| OnFileUploadCompleted | EventCallback<DwsFileUploadItem> | Fired when a file's upload finishes successfully. |
| OnFileUploadFailed | EventCallback<(DwsFileUploadItem Item, Exception Exception)> | Fired when a file's upload throws. |
| OnFileUploadCanceled | EventCallback<DwsFileUploadItem> | Fired when a running upload was cancelled (status Canceled, not Failed). |
| OnAllUploadsCompleted | EventCallback | Fired once every selected file has reached a terminal state (Uploaded, Failed, Canceled or Rejected) and at least one upload ran. |
| OnFileRejected | EventCallback<DwsFileUploadItem> | Fired when a file is rejected by size/filter/ValidationCallback. |
| OnFileRemoved | EventCallback<DwsFileUploadItem> | Fired when a file is removed from the selection. |
| Name | Typ | Default | Description |
|---|---|---|---|
| Element | ElementReference | The associated web component. May be null if accessed before the component is rendered. | |
| ComponentGuid | Guid | Unique identifier for the component. | |
| TypeString | string | The name of the component type, obtained from reflection. | |
| Authorized_RegisterEnabled | bool | false | Indicates whether this component is enabled through a permission registry. |
| Authorized_RegisterSelected | bool | false | Indicates whether this component is selected in permission selection mode. |
| GetInitializedState | bool | false | Returns whether the component is initialized. |
| GetRenderModeState | DwsRenderMode | Returns the current render mode. | |
| GetComponentState | DwsComponentStateType | Returns the current component state. | |
| GetIsInteractiveState | bool | false | Returns whether the component is interactive. |
| GetIsPrerenderingState | bool | false | Returns whether the component is prerendering. |
| GetComponentLoadingState | bool | false | Returns whether the component is loading. |
| IsFormBusy | bool | false | Whether the DwsForm (or DwsFormBusyRegion) around the component is locked because its submit handler is running. The state itself is the cascaded FormBusyState (IDwsFormBusyState). |
| Name | Typ | Parameters | Description |
|---|---|---|---|
| DebugInfo | void | Logs debug information about the component. | |
| UpdateState | void | Updates the component's state and triggers StateHasChanged. | |
| UpdateStateAsync | Task | Asynchronously updates the component's state and triggers StateHasChanged. | |
| Dispose | void | Disposes the component and releases resources. | |
| FocusAsync | ValueTask | bool containedInScrollableList | Sets focus to the component's element. |
| Name | Typ | Default | Description |
|---|---|---|---|
| Name | string | Required unique identifier for the component within its container. | |
| Visible | bool | true | Determines if the component is visible in the UI. |
| Disabled | bool | false | Disables the form control, ensuring it doesn't participate in form submission. |
| ComponentNameSpace | string | The namespace for permission-based access control. | |
| PermissionKey | string? | null | A stable key that takes the place of Name in the generated permission namespace (Page.PermissionKey): the stored permission survives a rename, and components that share a key share one permission entry. Null: keyed by Name. Read once, when the component registers; an explicit ComponentNameSpace wins. |
| Class | string | Optional CSS class names. | |
| Style | string | Optional in-line styles. | |
| Tag | object | An optional user-defined object to store any additional data with the component. | |
| BackReference | DwsReference | A reference to the enclosing component. | |
| ID | string | The HTML ID attribute for the component. | |
| AdditionalAttributes | Dictionary<string, object> | Additional HTML attributes for the component's root element. | |
| IgnorePermissionChecks | bool | false | Bypasses all permission checks for this component. |
| IgnorePermissionSelection | bool | false | Ignore permission selection mode for this component. |
| IgnoreFormBusy | bool | false | Takes the component out of the submit lock of the DwsForm (or DwsFormBusyRegion) around it: IsFormBusy stays false for it. |
| Name | Typ | Description |
|---|---|---|
| OnInitializedCallbackStarted | EventCallback | Callback when OnInitialized starts. |
| OnInitializedCallback | EventCallback | Callback during OnInitialized. |
| OnInitializedCallbackCompleted | EventCallback | Callback when OnInitialized completes. |
| OnInitializedAsyncCallbackStarted | EventCallback | Callback when OnInitializedAsync starts. |
| OnInitializedAsyncCallback | EventCallback | Callback during OnInitializedAsync. |
| OnInitializedAsyncCallbackCompleted | EventCallback | Callback when OnInitializedAsync completes. |
| OnIsComponentLoadingChanged | EventCallback<bool> | Callback when IsComponentLoading changes. |
| OnCurrentRenderModeChanged | EventCallback<DwsRenderMode> | Callback when CurrentRenderMode changes. |
| OnComponentStateChanged | EventCallback<DwsComponentStateType> | Callback when ComponentState changes. |
