# dialog\_media\_upload

Source: https://zotonic.com/docs/2059/dialog_media_upload

URI: https://zotonic.com/id/2059

Language: en



Shows the admin dialog for uploading a media item. See [Media](/id/doc_developerguide_media#guide-media).

The dialog accepts either a local file or a URL.

Arguments:

- `intent` is `create`, `connect`, `select`, or `update`. It defaults to `update` when `id` is present and to `connect` otherwise.
- `id` identifies the media resource whose file is replaced for `update`.
- `subject_id` and `predicate` connect a newly created medium to a resource; `predicate` defaults to `depiction`.
- `title` overrides the dialog heading.
- `stay` prevents redirecting after creation.
- `center` controls the dialog's centering option and defaults to `1`.
- `action` can be repeated to run actions after a successful upload.
- `callback` names a safe JavaScript callback that receives the new media id.

```django
{% button text="Add image" action={dialog_media_upload intent="connect" subject_id=id predicate="depiction"} %}
```

License: 

Attribution: 

Related resources: https://zotonic.com/api/agent/related/2059?language=en


## API access

- [API help](<https://zotonic.com/api-help>)
- [OpenAPI specification](<https://zotonic.com/openapi.json>)
- [This resource as JSON](<https://zotonic.com/api/agent/resource/2059?language=en>)
