file_upload() renders an accessible drag-and-drop file uploader with size validation, removable file chips, and zero-dependency uploads (raw binary X-Filename over POST /api/chat/attachments — works even without python-multipart).
file_upload()
X-Filename
POST /api/chat/attachments
python-multipart
<ComponentPreview title="Interactive File Uploader">
{
"type": "file_upload",
"label": "Upload dataset or document",
"name": "doc",
"accept": ".csv,.pdf,.txt,.md,.json",
"max_size_mb": 10,
"help_text": "CSV, PDF, Markdown, JSON, or plain text (max 10 MB)"
}
</ComponentPreview>
<Tabs>
<Tab title="Python (aiui.interface)">
</Tab>
<Tab title="Python (@aiui.page)">
<Tab title="YAML (app.yaml)">
</Tabs>
text/html
image/svg+xml
application/javascript
aiui.get_uploaded_file(handle_or_id)
aiui.interface()
None
3600
500
| Parameter | Type | Default | Description |
|---|---|---|---|
| label | str | "Upload file" | Accessible field label shown above the dropzone. |
label
str
"Upload file"
| name | str | "files" | Form field key submitted with the uploaded file handle(s). |
name
"files"
| accept | str \| None | None | Comma-separated file extensions or MIME filters (e.g. ".csv,.pdf"). |
accept
str \| None
".csv,.pdf"
| multiple | bool | False | Allow uploading and submitting multiple files as a list of handles. |
multiple
bool
False
| max_size_mb | float | 10 | Client-side file size cap in MB (enforced on the server too). |
max_size_mb
float
10
| help_text | str \| None | None | Optional helper caption displayed inside the dropzone. |
help_text
| auto_submit | bool | False | Automatically submit the enclosing form as soon as upload finishes. |
auto_submit