Skip to main content

Module files

Module files 

Source
Expand description

OS file drops - the one drop type where the payload arrives in the native event (evt.files()) rather than through the shared context.

Works on web and desktop. On desktop, dioxus::html::FileData::path gives you the real filesystem path; on web you read contents with read_bytes() / read_string() / byte_stream().

rsx! {
    FileDropZone {
        filter: FileFilter::new().extensions(["png", "jpg"]).max_size(5_000_000),
        on_files: move |drop: FileDrop| async move {
            for f in drop.files {
                let bytes = f.read_bytes().await.unwrap();
                // ...
            }
        },
        "Drop images here"
    }
}

Re-exports§

pub use FileDropZone_completions::Component::FileDropZone;

Structs§

FileDrop
A batch of dropped files plus where they landed.
FileDropZoneProps
Properties for the FileDropZone component.
FileFilter
Declarative acceptance rules for dropped files.

Enums§

FileRejection
Why a file was rejected by a FileFilter.

Functions§

FileDropZone
A zone that accepts files dragged in from the operating system.