rememberFileUploadPattern

fun rememberFileUploadPattern(onFilesSelect: (ImmutableList<UploadedFile>) -> Unit, type: FileUploadType = FileUploadType.File(), mode: FileUploadMode = FileUploadMode.Single, title: String? = null, directory: PlatformFile? = null, dialogSettings: FileKitDialogSettings = FileKitDialogSettings.createDefault()): FileUploadPatternState(source)

Creates and remembers a FileUploadPatternState to manage file upload logic within a Composable.

This function initializes the necessary launchers for picking files from the system or capturing media via the camera. It abstracts the complexity of handling different selection modes (single vs. multiple) and source types.

Return

A FileUploadPatternState used to trigger the pickers and query the current selection configuration.

Parameters

onFilesSelect

Callback invoked when files are successfully selected or captured. Returns an empty list if the selection is cancelled or an error occurs.

type

The category of files to be selected (e.g., Image, Video, or generic File). This also determines the available sources like Camera or Gallery.

mode

The selection strategy: FileUploadMode.Single for one file or FileUploadMode.Multiple for several files with an optional limit.

title

An optional title displayed in the file picker system dialog.

directory

An optional initial directory for the file picker to open in.

dialogSettings

Specific configuration for the picker dialog, primarily for desktop platforms.