file-upload
Reusable file-upload component.
Usage
Components are auto-discovered. Use the component directly in any .wrn view:
<file-upload
store="public"
endpoint="/api/upload"
accept="accept"
multiple="false"
max="0"
/>Legacy mount name: data-component="file-upload".
Props and attributes
| Prop | Type | Requirement | Default |
|---|---|---|---|
store | string | Optional | "public" |
endpoint | string | Optional | "/api/upload" |
accept | string | Optional | "" |
multiple | boolean | Optional | false |
max | number | Optional | 0 |
label | string | Optional | "Drag files here or click to browse" |
class | string | Optional | "" |
Slots
This component does not declare a slot.
Events
This component does not declare a custom event.
Source contract
Installed source: components/file-upload.wrn
// Drag-and-drop file uploader with per-file progress. Progressive enhancement:
// the markup is inert until /__wrnexus/uploader.js loads (auto-injected when a
// page contains `data-uploader`). Pairs with `handleUpload` on the server —
// files POST to `endpoint`, which returns `{ ok, files:[{ key, url, … }] }`.
//
// <div data-component="file-upload" store="public" endpoint="/api/upload"
// accept="image/*" max="10000000" multiple="true">
</div>
component FileUpload {
props {
store = "public"
endpoint = "/api/upload"
accept = ""
multiple = false
max = 0
label = "Drag files here or click to browse"
class = ""
}
view {
<div class="wire-fileupload {class}" data-uploader="{store}" data-endpoint="{endpoint}" data-accept="{accept}" data-multiple="{multiple}" data-max="{max}" data-label="{label}">
</div>
}
}