Upload Module

Upload components allow your app to accept user-uploaded files via drag'n'drop

Types

Type Description

Attr

A list of children or a property for this dash component

Prop

• contents (string | list with values of type: string) - The contents of the uploaded file as a binary string • filename (string | list with values of type: string) - The name of the file(s) that was(were) uploaded. Note that this does not include the path of the file (for security reasons). • last_modified (number | list with values of type: number) - The last modified date of the file that was uploaded in unix time (seconds since 1970). • children (a list of or a singular dash component, string or number | string) - Contents of the upload component • accept (string) - Allow specific types of files. See https://github.com/okonet/attr-accept for more information. Keep in mind that mime type determination is not reliable across platforms. CSV files, for example, are reported as text/plain under macOS but as application/vnd.ms-excel under Windows. In some cases there might not be a mime type set at all. See: https://github.com/react-dropzone/react-dropzone/issues/276 • disabled (boolean; default false) - Enable/disable the upload component entirely • disable_click (boolean; default false) - Disallow clicking on the component to open the file dialog • max_size (number; default -1) - Maximum file size in bytes. If `-1`, then infinite • min_size (number; default 0) - Minimum file size in bytes • multiple (boolean; default false) - Allow dropping multiple files • className (string) - HTML class name of the component • className_active (string) - HTML class name of the component while active • className_reject (string) - HTML class name of the component if rejected • className_disabled (string) - HTML class name of the component if disabled • style (record; default {}) - CSS styles to apply • style_active (record; default { borderStyle: 'solid', borderColor: '#6c6', backgroundColor: '#eee', }) - CSS styles to apply while active • style_reject (record; default { borderStyle: 'solid', borderColor: '#c66', backgroundColor: '#eee', }) - CSS styles if rejected • style_disabled (record; default { opacity: 0.5, }) - CSS styles if disabled • loading_state (record with the fields: 'is_loading: boolean (optional)', 'prop_name: string (optional)', 'component_name: string (optional)') - Object that holds the loading state object coming from dash-renderer

Upload

Upload components allow your app to accept user-uploaded files via drag'n'drop

UploadContents

UploadFileName

UploadLastModified

Functions and values

Function or value Description

Upload.upload id attrs

Full Usage: Upload.upload id attrs

Parameters:
    id : string
    attrs : Attr list

Returns: DashComponent

Upload components allow your app to accept user-uploaded files via drag'n'drop Properties: • id (string) - The ID of this component, used to identify dash components in callbacks. The ID needs to be unique across all of the components in an app. • contents (string | list with values of type: string) - The contents of the uploaded file as a binary string • filename (string | list with values of type: string) - The name of the file(s) that was(were) uploaded. Note that this does not include the path of the file (for security reasons). • last_modified (number | list with values of type: number) - The last modified date of the file that was uploaded in unix time (seconds since 1970). • children (a list of or a singular dash component, string or number | string) - Contents of the upload component • accept (string) - Allow specific types of files. See https://github.com/okonet/attr-accept for more information. Keep in mind that mime type determination is not reliable across platforms. CSV files, for example, are reported as text/plain under macOS but as application/vnd.ms-excel under Windows. In some cases there might not be a mime type set at all. See: https://github.com/react-dropzone/react-dropzone/issues/276 • disabled (boolean; default false) - Enable/disable the upload component entirely • disable_click (boolean; default false) - Disallow clicking on the component to open the file dialog • max_size (number; default -1) - Maximum file size in bytes. If `-1`, then infinite • min_size (number; default 0) - Minimum file size in bytes • multiple (boolean; default false) - Allow dropping multiple files • className (string) - HTML class name of the component • className_active (string) - HTML class name of the component while active • className_reject (string) - HTML class name of the component if rejected • className_disabled (string) - HTML class name of the component if disabled • style (record; default {}) - CSS styles to apply • style_active (record; default { borderStyle: 'solid', borderColor: '#6c6', backgroundColor: '#eee', }) - CSS styles to apply while active • style_reject (record; default { borderStyle: 'solid', borderColor: '#c66', backgroundColor: '#eee', }) - CSS styles if rejected • style_disabled (record; default { opacity: 0.5, }) - CSS styles if disabled • loading_state (record with the fields: 'is_loading: boolean (optional)', 'prop_name: string (optional)', 'component_name: string (optional)') - Object that holds the loading state object coming from dash-renderer

id : string
attrs : Attr list
Returns: DashComponent