Skip to content

File Upload

type: 19 Modals

The File Upload lets users upload files (up to 10) from a modal. It goes inside a Label.

Preview
Send a screenshot
Error screenshots*
Upload up to 3 images.
Drag files or click to upload
modal.json
{
"type": 9,
"data": {
"custom_id": "send_screenshot",
"title": "Send a screenshot",
"components": [
{
"type": 18,
"label": "Error screenshots",
"description": "Upload up to 3 images.",
"component": {
"type": 19,
"custom_id": "screenshots",
"min_values": 1,
"max_values": 3,
"file_types": [
"image"
]
}
}
]
}
}
Field Type Description
type integer required Always 19.
id integer optional Unique identifier.
custom_id string required 1-100 characters.
min_values integer optional Minimum files (0-10). Defaults to 1.
max_values integer optional Maximum files (max 10). Defaults to 1.
required boolean optional Defaults to true.
file_types array of strings optional Up to 10 filters: "image", "video", "audio" or extensions like ".pdf".

values contains the attachment IDs, and the full data (URL, name, size…) is in resolved.attachments:

MODAL_SUBMIT data (trimmed)
{
"custom_id": "send_screenshot",
"components": [
{
"type": 18,
"id": 1,
"component": { "type": 19, "id": 2, "custom_id": "screenshots", "values": ["111111111111111111"] }
}
],
"resolved": {
"attachments": {
"111111111111111111": {
"id": "111111111111111111",
"filename": "error.png",
"size": 48213,
"url": "https://cdn.discordapp.com/ephemeral-attachments/...",
"content_type": "image/png"
}
}
}
}

Respond to the interaction with the JSON above.