You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Have you ever wanted to collect more than text from a user through a modal? With the new [**File Upload**](/docs/components/reference#file-upload) component you can! You can specify a min and max number of files accepted between 0 and 10, and if uploading files within that limit is required before submitting. Any file types are accepted, and the max file size is based on the user's upload limit in that channel.
@@ -2053,7 +2056,115 @@ The `description` may display above or below the `component` depending on the pl
2053
2056
```
2054
2057
</Collapsible>
2055
2058
2056
-
--------------------------------
2059
+
--------------
2060
+
## File Upload
2061
+
2062
+
File Upload is an interactive component that allows users to upload files in modals. File Uploads can be configured to have a minimum and maximum number of files between 0 and 10, along with `required` for if the upload is required to submit the modal. The max file size a user can upload is based on the user's upload limit in that channel.
2063
+
2064
+
File Uploads are available on modals. They must be placed inside a [Label](/docs/components/reference#label).
| id | integer | Unique identifier for the component |
2083
+
| custom_id | string | Developer-defined identifier for the input; max 100 characters |
2084
+
| values | array of snowflakes | IDs of the uploaded files found in the [resolved data](/docs/interactions/receiving-and-responding#interaction-object-resolved-data-structure)|
2085
+
2086
+
###### Examples
2087
+
2088
+
<Collapsibletitle="Modal Example"description="Modal create payload with a File Upload component"icon="code">
2089
+
2090
+
<Collapsibletitle="Rendered Example"description="Visualization of the message created by the payload below"icon="image"nested={true}>
2091
+

2092
+
</Collapsible>
2093
+
2094
+
```json
2095
+
{
2096
+
"type": 9,
2097
+
"data": {
2098
+
"custom_id": "bug_submit_modal",
2099
+
"title": "Bug Submission",
2100
+
"components": [
2101
+
{
2102
+
"type": 18, // ComponentType.LABEL
2103
+
"label": "File Upload",
2104
+
"description": "Please upload a screenshot or other image that shows the bug you encountered.",
2105
+
"component": {
2106
+
"type": 19, // ComponentType.FILE_UPLOAD
2107
+
"custom_id": "file_upload",
2108
+
"min_values": 1,
2109
+
"max_values": 10,
2110
+
"required": true
2111
+
}
2112
+
}
2113
+
]
2114
+
}
2115
+
}
2116
+
```
2117
+
</Collapsible>
2118
+
2119
+
<Collapsibletitle="Modal Submit Interaction Data Example"description="When a user submits a modal containing a File Upload"icon="code">
2120
+
2121
+
When a user submits a modal that contains a File Upload, this is the basic form of the interaction data payload you will receive. The full payload
2122
+
is available in the [interaction](/docs/interactions/receiving-and-responding#interaction-object-interaction-structure) reference.
2123
+
2124
+
```json
2125
+
{
2126
+
"type": 5, // InteractionType.MODAL_SUBMIT
2127
+
...additionalInteractionFields, // See the Interaction documentation for all fields
0 commit comments