<labelclass="govuk-label"for="file-upload-1">
Upload a file
</label><inputclass="govuk-file-upload"id="file-upload-1"name="file-upload-1"type="file"></div>
<p>
Use options to customise the appearance, content and behaviour of a component when using a macro, for example, changing the text.
</p>
<p>
Some options are required for the macro to work; these are marked as "Required" in the option description.
</p>
<p>
If you're using Nunjucks macros in production with "html" options, or ones ending with "html", you must sanitise the HTML to protect against <a href="https://developer.mozilla.org/en-US/docs/Glossary/Cross-site_scripting">cross-site scripting exploits</a>.
</p>
<table class="govuk-table app-options__table" id="options-file-upload-example--primary">
<caption class="govuk-table__caption govuk-heading-m govuk-visually-hidden">Primary options</caption>
<thead class="govuk-table__head">
<tr class="govuk-table__row">
<th class="govuk-table__header app-options__limit-table-cell" scope="col">Name</th>
<th class="govuk-table__header app-options__limit-table-cell" scope="col">Type</th>
<th class="govuk-table__header" scope="col">Description</th>
</tr>
</thead>
<tbody class="govuk-table__body">
<tr class="govuk-table__row">
<th class="govuk-table__header" scope="row">name</th>
<td class="govuk-table__cell ">string</td>
<td class="govuk-table__cell ">
<strong>Required.</strong>
The name of the input, which is submitted with the form data.
</td>
</tr>
<tr class="govuk-table__row">
<th class="govuk-table__header" scope="row">id</th>
<td class="govuk-table__cell ">string</td>
<td class="govuk-table__cell ">
<strong>Required.</strong>
The ID of the input.
</td>
</tr>
<tr class="govuk-table__row">
<th class="govuk-table__header" scope="row">value</th>
<td class="govuk-table__cell ">string</td>
<td class="govuk-table__cell ">
Optional initial value of the input.
</td>
</tr>
<tr class="govuk-table__row">
<th class="govuk-table__header" scope="row">describedBy</th>
<td class="govuk-table__cell ">string</td>
<td class="govuk-table__cell ">
One or more element IDs to add to the <code>aria-describedby</code> attribute, used to provide additional descriptive information for screenreader users.
</td>
</tr>
<tr class="govuk-table__row">
<th class="govuk-table__header" scope="row">label</th>
<td class="govuk-table__cell ">object</td>
<td class="govuk-table__cell ">
<strong>Required.</strong>
Options for the label component.
See <a href="#options-file-upload-example--label">label</a>.
</td>
</tr>
<tr class="govuk-table__row">
<th class="govuk-table__header" scope="row">hint</th>
<td class="govuk-table__cell ">object</td>
<td class="govuk-table__cell ">
Options for the hint component.
See <a href="#options-file-upload-example--hint">hint</a>.
</td>
</tr>
<tr class="govuk-table__row">
<th class="govuk-table__header" scope="row">errorMessage</th>
<td class="govuk-table__cell ">object</td>
<td class="govuk-table__cell ">
Options for the error message component. The error message component will not display if you use a falsy value for <code>errorMessage</code>, for example <code>false</code> or <code>null</code>.
See <a href="/components/error-message/#options-error-message-example">errorMessage</a>.
</td>
</tr>
<tr class="govuk-table__row">
<th class="govuk-table__header" scope="row">formGroup</th>
<td class="govuk-table__cell ">object</td>
<td class="govuk-table__cell ">
Options for the form-group wrapper.
See <a href="#options-file-upload-example--formGroup">formGroup</a>.
</td>
</tr>
<tr class="govuk-table__row">
<th class="govuk-table__header" scope="row">classes</th>
<td class="govuk-table__cell ">string</td>
<td class="govuk-table__cell ">
Classes to add to the file upload component.
</td>
</tr>
<tr class="govuk-table__row">
<th class="govuk-table__header" scope="row">attributes</th>
<td class="govuk-table__cell ">object</td>
<td class="govuk-table__cell ">
HTML attributes (for example data attributes) to add to the file upload component.
</td>
</tr>
</tbody>
</table>
<table class="govuk-table app-options__table" id="options-file-upload-example--formGroup">
<caption class="govuk-table__caption govuk-heading-m ">Options for formGroup</caption>
<thead class="govuk-table__head">
<tr class="govuk-table__row">
<th class="govuk-table__header app-options__limit-table-cell" scope="col">Name</th>
<th class="govuk-table__header app-options__limit-table-cell" scope="col">Type</th>
<th class="govuk-table__header" scope="col">Description</th>
</tr>
</thead>
<tbody class="govuk-table__body">
<tr class="govuk-table__row">
<th class="govuk-table__header" scope="row">classes</th>
<td class="govuk-table__cell ">string</td>
<td class="govuk-table__cell ">
Classes to add to the form group (for example to show error state for the whole group).
</td>
</tr>
</tbody>
</table>
<table class="govuk-table app-options__table" id="options-file-upload-example--label">
<caption class="govuk-table__caption govuk-heading-m ">Options for label</caption>
<thead class="govuk-table__head">
<tr class="govuk-table__row">
<th class="govuk-table__header app-options__limit-table-cell" scope="col">Name</th>
<th class="govuk-table__header app-options__limit-table-cell" scope="col">Type</th>
<th class="govuk-table__header" scope="col">Description</th>
</tr>
</thead>
<tbody class="govuk-table__body">
<tr class="govuk-table__row">
<th class="govuk-table__header" scope="row">text</th>
<td class="govuk-table__cell ">string</td>
<td class="govuk-table__cell ">
<strong>Required.</strong>
If <code>html</code> is set, this is not required. Text to use within the label. If <code>html</code> is provided, the <code>text</code> option will be ignored.
</td>
</tr>
<tr class="govuk-table__row">
<th class="govuk-table__header" scope="row">html</th>
<td class="govuk-table__cell ">string</td>
<td class="govuk-table__cell ">
<strong>Required.</strong>
If <code>text</code> is set, this is not required. HTML to use within the label. If <code>html</code> is provided, the <code>text</code> option will be ignored.
</td>
</tr>
<tr class="govuk-table__row">
<th class="govuk-table__header" scope="row">for</th>
<td class="govuk-table__cell ">string</td>
<td class="govuk-table__cell ">
The value of the <code>for</code> attribute, the ID of the input the label is associated with.
</td>
</tr>
<tr class="govuk-table__row">
<th class="govuk-table__header" scope="row">isPageHeading</th>
<td class="govuk-table__cell ">boolean</td>
<td class="govuk-table__cell ">
Whether the label also acts as the heading for the page.
</td>
</tr>
<tr class="govuk-table__row">
<th class="govuk-table__header" scope="row">classes</th>
<td class="govuk-table__cell ">string</td>
<td class="govuk-table__cell ">
Classes to add to the label tag.
</td>
</tr>
<tr class="govuk-table__row">
<th class="govuk-table__header" scope="row">attributes</th>
<td class="govuk-table__cell ">object</td>
<td class="govuk-table__cell ">
HTML attributes (for example data attributes) to add to the label tag.
</td>
</tr>
</tbody>
</table>
<table class="govuk-table app-options__table" id="options-file-upload-example--hint">
<caption class="govuk-table__caption govuk-heading-m ">Options for hint</caption>
<thead class="govuk-table__head">
<tr class="govuk-table__row">
<th class="govuk-table__header app-options__limit-table-cell" scope="col">Name</th>
<th class="govuk-table__header app-options__limit-table-cell" scope="col">Type</th>
<th class="govuk-table__header" scope="col">Description</th>
</tr>
</thead>
<tbody class="govuk-table__body">
<tr class="govuk-table__row">
<th class="govuk-table__header" scope="row">text</th>
<td class="govuk-table__cell ">string</td>
<td class="govuk-table__cell ">
<strong>Required.</strong>
If <code>html</code> is set, this is not required. Text to use within the hint. If <code>html</code> is provided, the <code>text</code> option will be ignored.
</td>
</tr>
<tr class="govuk-table__row">
<th class="govuk-table__header" scope="row">html</th>
<td class="govuk-table__cell ">string</td>
<td class="govuk-table__cell ">
<strong>Required.</strong>
If <code>text</code> is set, this is not required. HTML to use within the hint. If <code>html</code> is provided, the <code>text</code> option will be ignored.
</td>
</tr>
<tr class="govuk-table__row">
<th class="govuk-table__header" scope="row">id</th>
<td class="govuk-table__cell ">string</td>
<td class="govuk-table__cell ">
Optional ID attribute to add to the hint span tag.
</td>
</tr>
<tr class="govuk-table__row">
<th class="govuk-table__header" scope="row">classes</th>
<td class="govuk-table__cell ">string</td>
<td class="govuk-table__cell ">
Classes to add to the hint span tag.
</td>
</tr>
<tr class="govuk-table__row">
<th class="govuk-table__header" scope="row">attributes</th>
<td class="govuk-table__cell ">object</td>
<td class="govuk-table__cell ">
HTML attributes (for example data attributes) to add to the hint span tag.
</td>
</tr>
</tbody>
</table>
You should only ask users to upload something if it’s critical to the delivery of your service.
How it works
There are 2 ways to use the file upload component. You can use HTML or, if you’re using Nunjucks or the GOV.UK Prototype Kit, you can use the Nunjucks macro.
<labelclass="govuk-label"for="file-upload-1">
Upload a file
</label><inputclass="govuk-file-upload"id="file-upload-1"name="file-upload-1"type="file"></div>
<p>
Use options to customise the appearance, content and behaviour of a component when using a macro, for example, changing the text.
</p>
<p>
Some options are required for the macro to work; these are marked as "Required" in the option description.
</p>
<p>
If you're using Nunjucks macros in production with "html" options, or ones ending with "html", you must sanitise the HTML to protect against <a href="https://developer.mozilla.org/en-US/docs/Glossary/Cross-site_scripting">cross-site scripting exploits</a>.
</p>
<table class="govuk-table app-options__table" id="options-file-upload-second-example--primary">
<caption class="govuk-table__caption govuk-heading-m govuk-visually-hidden">Primary options</caption>
<thead class="govuk-table__head">
<tr class="govuk-table__row">
<th class="govuk-table__header app-options__limit-table-cell" scope="col">Name</th>
<th class="govuk-table__header app-options__limit-table-cell" scope="col">Type</th>
<th class="govuk-table__header" scope="col">Description</th>
</tr>
</thead>
<tbody class="govuk-table__body">
<tr class="govuk-table__row">
<th class="govuk-table__header" scope="row">name</th>
<td class="govuk-table__cell ">string</td>
<td class="govuk-table__cell ">
<strong>Required.</strong>
The name of the input, which is submitted with the form data.
</td>
</tr>
<tr class="govuk-table__row">
<th class="govuk-table__header" scope="row">id</th>
<td class="govuk-table__cell ">string</td>
<td class="govuk-table__cell ">
<strong>Required.</strong>
The ID of the input.
</td>
</tr>
<tr class="govuk-table__row">
<th class="govuk-table__header" scope="row">value</th>
<td class="govuk-table__cell ">string</td>
<td class="govuk-table__cell ">
Optional initial value of the input.
</td>
</tr>
<tr class="govuk-table__row">
<th class="govuk-table__header" scope="row">describedBy</th>
<td class="govuk-table__cell ">string</td>
<td class="govuk-table__cell ">
One or more element IDs to add to the <code>aria-describedby</code> attribute, used to provide additional descriptive information for screenreader users.
</td>
</tr>
<tr class="govuk-table__row">
<th class="govuk-table__header" scope="row">label</th>
<td class="govuk-table__cell ">object</td>
<td class="govuk-table__cell ">
<strong>Required.</strong>
Options for the label component.
See <a href="#options-file-upload-second-example--label">label</a>.
</td>
</tr>
<tr class="govuk-table__row">
<th class="govuk-table__header" scope="row">hint</th>
<td class="govuk-table__cell ">object</td>
<td class="govuk-table__cell ">
Options for the hint component.
See <a href="#options-file-upload-second-example--hint">hint</a>.
</td>
</tr>
<tr class="govuk-table__row">
<th class="govuk-table__header" scope="row">errorMessage</th>
<td class="govuk-table__cell ">object</td>
<td class="govuk-table__cell ">
Options for the error message component. The error message component will not display if you use a falsy value for <code>errorMessage</code>, for example <code>false</code> or <code>null</code>.
See <a href="/components/error-message/#options-error-message-example">errorMessage</a>.
</td>
</tr>
<tr class="govuk-table__row">
<th class="govuk-table__header" scope="row">formGroup</th>
<td class="govuk-table__cell ">object</td>
<td class="govuk-table__cell ">
Options for the form-group wrapper.
See <a href="#options-file-upload-second-example--formGroup">formGroup</a>.
</td>
</tr>
<tr class="govuk-table__row">
<th class="govuk-table__header" scope="row">classes</th>
<td class="govuk-table__cell ">string</td>
<td class="govuk-table__cell ">
Classes to add to the file upload component.
</td>
</tr>
<tr class="govuk-table__row">
<th class="govuk-table__header" scope="row">attributes</th>
<td class="govuk-table__cell ">object</td>
<td class="govuk-table__cell ">
HTML attributes (for example data attributes) to add to the file upload component.
</td>
</tr>
</tbody>
</table>
<table class="govuk-table app-options__table" id="options-file-upload-second-example--formGroup">
<caption class="govuk-table__caption govuk-heading-m ">Options for formGroup</caption>
<thead class="govuk-table__head">
<tr class="govuk-table__row">
<th class="govuk-table__header app-options__limit-table-cell" scope="col">Name</th>
<th class="govuk-table__header app-options__limit-table-cell" scope="col">Type</th>
<th class="govuk-table__header" scope="col">Description</th>
</tr>
</thead>
<tbody class="govuk-table__body">
<tr class="govuk-table__row">
<th class="govuk-table__header" scope="row">classes</th>
<td class="govuk-table__cell ">string</td>
<td class="govuk-table__cell ">
Classes to add to the form group (for example to show error state for the whole group).
</td>
</tr>
</tbody>
</table>
<table class="govuk-table app-options__table" id="options-file-upload-second-example--label">
<caption class="govuk-table__caption govuk-heading-m ">Options for label</caption>
<thead class="govuk-table__head">
<tr class="govuk-table__row">
<th class="govuk-table__header app-options__limit-table-cell" scope="col">Name</th>
<th class="govuk-table__header app-options__limit-table-cell" scope="col">Type</th>
<th class="govuk-table__header" scope="col">Description</th>
</tr>
</thead>
<tbody class="govuk-table__body">
<tr class="govuk-table__row">
<th class="govuk-table__header" scope="row">text</th>
<td class="govuk-table__cell ">string</td>
<td class="govuk-table__cell ">
<strong>Required.</strong>
If <code>html</code> is set, this is not required. Text to use within the label. If <code>html</code> is provided, the <code>text</code> option will be ignored.
</td>
</tr>
<tr class="govuk-table__row">
<th class="govuk-table__header" scope="row">html</th>
<td class="govuk-table__cell ">string</td>
<td class="govuk-table__cell ">
<strong>Required.</strong>
If <code>text</code> is set, this is not required. HTML to use within the label. If <code>html</code> is provided, the <code>text</code> option will be ignored.
</td>
</tr>
<tr class="govuk-table__row">
<th class="govuk-table__header" scope="row">for</th>
<td class="govuk-table__cell ">string</td>
<td class="govuk-table__cell ">
The value of the <code>for</code> attribute, the ID of the input the label is associated with.
</td>
</tr>
<tr class="govuk-table__row">
<th class="govuk-table__header" scope="row">isPageHeading</th>
<td class="govuk-table__cell ">boolean</td>
<td class="govuk-table__cell ">
Whether the label also acts as the heading for the page.
</td>
</tr>
<tr class="govuk-table__row">
<th class="govuk-table__header" scope="row">classes</th>
<td class="govuk-table__cell ">string</td>
<td class="govuk-table__cell ">
Classes to add to the label tag.
</td>
</tr>
<tr class="govuk-table__row">
<th class="govuk-table__header" scope="row">attributes</th>
<td class="govuk-table__cell ">object</td>
<td class="govuk-table__cell ">
HTML attributes (for example data attributes) to add to the label tag.
</td>
</tr>
</tbody>
</table>
<table class="govuk-table app-options__table" id="options-file-upload-second-example--hint">
<caption class="govuk-table__caption govuk-heading-m ">Options for hint</caption>
<thead class="govuk-table__head">
<tr class="govuk-table__row">
<th class="govuk-table__header app-options__limit-table-cell" scope="col">Name</th>
<th class="govuk-table__header app-options__limit-table-cell" scope="col">Type</th>
<th class="govuk-table__header" scope="col">Description</th>
</tr>
</thead>
<tbody class="govuk-table__body">
<tr class="govuk-table__row">
<th class="govuk-table__header" scope="row">text</th>
<td class="govuk-table__cell ">string</td>
<td class="govuk-table__cell ">
<strong>Required.</strong>
If <code>html</code> is set, this is not required. Text to use within the hint. If <code>html</code> is provided, the <code>text</code> option will be ignored.
</td>
</tr>
<tr class="govuk-table__row">
<th class="govuk-table__header" scope="row">html</th>
<td class="govuk-table__cell ">string</td>
<td class="govuk-table__cell ">
<strong>Required.</strong>
If <code>text</code> is set, this is not required. HTML to use within the hint. If <code>html</code> is provided, the <code>text</code> option will be ignored.
</td>
</tr>
<tr class="govuk-table__row">
<th class="govuk-table__header" scope="row">id</th>
<td class="govuk-table__cell ">string</td>
<td class="govuk-table__cell ">
Optional ID attribute to add to the hint span tag.
</td>
</tr>
<tr class="govuk-table__row">
<th class="govuk-table__header" scope="row">classes</th>
<td class="govuk-table__cell ">string</td>
<td class="govuk-table__cell ">
Classes to add to the hint span tag.
</td>
</tr>
<tr class="govuk-table__row">
<th class="govuk-table__header" scope="row">attributes</th>
<td class="govuk-table__cell ">object</td>
<td class="govuk-table__cell ">
HTML attributes (for example data attributes) to add to the hint span tag.
</td>
</tr>
</tbody>
</table>
<labelclass="govuk-label"for="file-upload-1">
Upload a file
</label><pid="file-upload-1-error"class="govuk-error-message"><spanclass="govuk-visually-hidden">Error:</span> The CSV must be smaller than 2MB
</p><inputclass="govuk-file-upload govuk-file-upload--error"id="file-upload-1"name="file-upload-1"type="file"aria-describedby="file-upload-1-error"></div>
<p>
Use options to customise the appearance, content and behaviour of a component when using a macro, for example, changing the text.
</p>
<p>
Some options are required for the macro to work; these are marked as "Required" in the option description.
</p>
<p>
If you're using Nunjucks macros in production with "html" options, or ones ending with "html", you must sanitise the HTML to protect against <a href="https://developer.mozilla.org/en-US/docs/Glossary/Cross-site_scripting">cross-site scripting exploits</a>.
</p>
<table class="govuk-table app-options__table" id="options-error-file-upload-example--primary">
<caption class="govuk-table__caption govuk-heading-m govuk-visually-hidden">Primary options</caption>
<thead class="govuk-table__head">
<tr class="govuk-table__row">
<th class="govuk-table__header app-options__limit-table-cell" scope="col">Name</th>
<th class="govuk-table__header app-options__limit-table-cell" scope="col">Type</th>
<th class="govuk-table__header" scope="col">Description</th>
</tr>
</thead>
<tbody class="govuk-table__body">
<tr class="govuk-table__row">
<th class="govuk-table__header" scope="row">name</th>
<td class="govuk-table__cell ">string</td>
<td class="govuk-table__cell ">
<strong>Required.</strong>
The name of the input, which is submitted with the form data.
</td>
</tr>
<tr class="govuk-table__row">
<th class="govuk-table__header" scope="row">id</th>
<td class="govuk-table__cell ">string</td>
<td class="govuk-table__cell ">
<strong>Required.</strong>
The ID of the input.
</td>
</tr>
<tr class="govuk-table__row">
<th class="govuk-table__header" scope="row">value</th>
<td class="govuk-table__cell ">string</td>
<td class="govuk-table__cell ">
Optional initial value of the input.
</td>
</tr>
<tr class="govuk-table__row">
<th class="govuk-table__header" scope="row">describedBy</th>
<td class="govuk-table__cell ">string</td>
<td class="govuk-table__cell ">
One or more element IDs to add to the <code>aria-describedby</code> attribute, used to provide additional descriptive information for screenreader users.
</td>
</tr>
<tr class="govuk-table__row">
<th class="govuk-table__header" scope="row">label</th>
<td class="govuk-table__cell ">object</td>
<td class="govuk-table__cell ">
<strong>Required.</strong>
Options for the label component.
See <a href="#options-error-file-upload-example--label">label</a>.
</td>
</tr>
<tr class="govuk-table__row">
<th class="govuk-table__header" scope="row">hint</th>
<td class="govuk-table__cell ">object</td>
<td class="govuk-table__cell ">
Options for the hint component.
See <a href="#options-error-file-upload-example--hint">hint</a>.
</td>
</tr>
<tr class="govuk-table__row">
<th class="govuk-table__header" scope="row">errorMessage</th>
<td class="govuk-table__cell ">object</td>
<td class="govuk-table__cell ">
Options for the error message component. The error message component will not display if you use a falsy value for <code>errorMessage</code>, for example <code>false</code> or <code>null</code>.
See <a href="/components/error-message/#options-error-message-example">errorMessage</a>.
</td>
</tr>
<tr class="govuk-table__row">
<th class="govuk-table__header" scope="row">formGroup</th>
<td class="govuk-table__cell ">object</td>
<td class="govuk-table__cell ">
Options for the form-group wrapper.
See <a href="#options-error-file-upload-example--formGroup">formGroup</a>.
</td>
</tr>
<tr class="govuk-table__row">
<th class="govuk-table__header" scope="row">classes</th>
<td class="govuk-table__cell ">string</td>
<td class="govuk-table__cell ">
Classes to add to the file upload component.
</td>
</tr>
<tr class="govuk-table__row">
<th class="govuk-table__header" scope="row">attributes</th>
<td class="govuk-table__cell ">object</td>
<td class="govuk-table__cell ">
HTML attributes (for example data attributes) to add to the file upload component.
</td>
</tr>
</tbody>
</table>
<table class="govuk-table app-options__table" id="options-error-file-upload-example--formGroup">
<caption class="govuk-table__caption govuk-heading-m ">Options for formGroup</caption>
<thead class="govuk-table__head">
<tr class="govuk-table__row">
<th class="govuk-table__header app-options__limit-table-cell" scope="col">Name</th>
<th class="govuk-table__header app-options__limit-table-cell" scope="col">Type</th>
<th class="govuk-table__header" scope="col">Description</th>
</tr>
</thead>
<tbody class="govuk-table__body">
<tr class="govuk-table__row">
<th class="govuk-table__header" scope="row">classes</th>
<td class="govuk-table__cell ">string</td>
<td class="govuk-table__cell ">
Classes to add to the form group (for example to show error state for the whole group).
</td>
</tr>
</tbody>
</table>
<table class="govuk-table app-options__table" id="options-error-file-upload-example--label">
<caption class="govuk-table__caption govuk-heading-m ">Options for label</caption>
<thead class="govuk-table__head">
<tr class="govuk-table__row">
<th class="govuk-table__header app-options__limit-table-cell" scope="col">Name</th>
<th class="govuk-table__header app-options__limit-table-cell" scope="col">Type</th>
<th class="govuk-table__header" scope="col">Description</th>
</tr>
</thead>
<tbody class="govuk-table__body">
<tr class="govuk-table__row">
<th class="govuk-table__header" scope="row">text</th>
<td class="govuk-table__cell ">string</td>
<td class="govuk-table__cell ">
<strong>Required.</strong>
If <code>html</code> is set, this is not required. Text to use within the label. If <code>html</code> is provided, the <code>text</code> option will be ignored.
</td>
</tr>
<tr class="govuk-table__row">
<th class="govuk-table__header" scope="row">html</th>
<td class="govuk-table__cell ">string</td>
<td class="govuk-table__cell ">
<strong>Required.</strong>
If <code>text</code> is set, this is not required. HTML to use within the label. If <code>html</code> is provided, the <code>text</code> option will be ignored.
</td>
</tr>
<tr class="govuk-table__row">
<th class="govuk-table__header" scope="row">for</th>
<td class="govuk-table__cell ">string</td>
<td class="govuk-table__cell ">
The value of the <code>for</code> attribute, the ID of the input the label is associated with.
</td>
</tr>
<tr class="govuk-table__row">
<th class="govuk-table__header" scope="row">isPageHeading</th>
<td class="govuk-table__cell ">boolean</td>
<td class="govuk-table__cell ">
Whether the label also acts as the heading for the page.
</td>
</tr>
<tr class="govuk-table__row">
<th class="govuk-table__header" scope="row">classes</th>
<td class="govuk-table__cell ">string</td>
<td class="govuk-table__cell ">
Classes to add to the label tag.
</td>
</tr>
<tr class="govuk-table__row">
<th class="govuk-table__header" scope="row">attributes</th>
<td class="govuk-table__cell ">object</td>
<td class="govuk-table__cell ">
HTML attributes (for example data attributes) to add to the label tag.
</td>
</tr>
</tbody>
</table>
<table class="govuk-table app-options__table" id="options-error-file-upload-example--hint">
<caption class="govuk-table__caption govuk-heading-m ">Options for hint</caption>
<thead class="govuk-table__head">
<tr class="govuk-table__row">
<th class="govuk-table__header app-options__limit-table-cell" scope="col">Name</th>
<th class="govuk-table__header app-options__limit-table-cell" scope="col">Type</th>
<th class="govuk-table__header" scope="col">Description</th>
</tr>
</thead>
<tbody class="govuk-table__body">
<tr class="govuk-table__row">
<th class="govuk-table__header" scope="row">text</th>
<td class="govuk-table__cell ">string</td>
<td class="govuk-table__cell ">
<strong>Required.</strong>
If <code>html</code> is set, this is not required. Text to use within the hint. If <code>html</code> is provided, the <code>text</code> option will be ignored.
</td>
</tr>
<tr class="govuk-table__row">
<th class="govuk-table__header" scope="row">html</th>
<td class="govuk-table__cell ">string</td>
<td class="govuk-table__cell ">
<strong>Required.</strong>
If <code>text</code> is set, this is not required. HTML to use within the hint. If <code>html</code> is provided, the <code>text</code> option will be ignored.
</td>
</tr>
<tr class="govuk-table__row">
<th class="govuk-table__header" scope="row">id</th>
<td class="govuk-table__cell ">string</td>
<td class="govuk-table__cell ">
Optional ID attribute to add to the hint span tag.
</td>
</tr>
<tr class="govuk-table__row">
<th class="govuk-table__header" scope="row">classes</th>
<td class="govuk-table__cell ">string</td>
<td class="govuk-table__cell ">
Classes to add to the hint span tag.
</td>
</tr>
<tr class="govuk-table__row">
<th class="govuk-table__header" scope="row">attributes</th>
<td class="govuk-table__cell ">object</td>
<td class="govuk-table__cell ">
HTML attributes (for example data attributes) to add to the hint span tag.
</td>
</tr>
</tbody>
</table>
{{ govukFileUpload({
id: "file-upload-1",
name: "file-upload-1",
label: {
text: "Upload a file"
},
errorMessage: {
text: "The CSV must be smaller than 2MB"
}
}) }}
Make sure errors follow the guidance in error message and have specific error messages for specific error states.
If no file has been selected
Say ‘Select a [whatever they need to select]’.
For example, ‘Select a report’.
If the file is the wrong file type
Say ‘The selected file must be a [list of file types]’.
For example, ‘The selected file must be a CSV or ODS’ or ‘The selected file must be a JPG, BMP, PNG, TIF or PDF’.
If the file is too big
Say ‘The selected file must be smaller than [largest file size]’.
For example, ‘The selected file must be smaller than 2MB’.
If the file is empty
Say ‘The selected file is empty’.
If the file contains a virus
Say ‘The selected file contains a virus’.
If the file is password protected
Say ‘The selected file is password protected’.
If there was a problem and the file was not uploaded
Say ‘The selected file could not be uploaded – try again’.
If there is a limit on how many files the user can select
Say ‘You can only select up to [highest number] files at the same time’.
For example, ‘You can only select up to 10 files at the same time’.
If the file is not in a template that must be used or the template has been changed