# dp-upload
A tunable file-upload button: a compact button with a selected-count badge and a row of
removable filename chips, no thumbnail grid. It replaces the native ``
and the legacy attachment uploader everywhere in the app.
Source: `static/js/components/AppUpload.js`.
## Modes
Set with the `mode` attribute:
| Mode | Behaviour |
|---|---|
| `attachment` (default) | On select, each file is uploaded to `endpoint` immediately; the returned UIDs are kept in a hidden `` that submits with the surrounding form. |
| `direct` | Each file is uploaded to `endpoint` immediately with `field-name` plus any `extraFields`; emits events instead of writing a form field. Used for direct-to-app uploads (e.g. the project file browser). |
| `field` | No AJAX. Wraps a real `` whose files submit with the form (e.g. the create-post inline image). |
## Attributes
| Attribute | Default | Description |
|---|---|---|
| `mode` | `attachment` | `attachment`, `direct`, or `field`. |
| `label` | (none) | Optional button text shown beside the icon. |
| `multiple` | off | Allow selecting more than one file. |
| `directory` | off | Allow selecting a whole directory (`webkitdirectory`). |
| `paste` | off | Attach images pasted anywhere in the surrounding `
Live example - select files to see the count and chips