Cookies - We use cookies to help improve your experience of using our website. For more information about the cookies we use see our privacy page. If you continue without changing your cookie settings we assume that you are happy with our use of cookies. You can change your cookie settings at any time by following the instructions on our privacy page
We recommend using a native input using type="file", rather than a custom implementation.
This is so:
the control gains focus when tabbing through the page
the control functions using a keyboard
the control functions using assistive technology
the control functions when javascript is not available
A custom implementation of this control would need to meet the criteria above.
HTML Snippet for file upload
<divclass="form-group"><labelclass="form-label"for="file-input">
Upload a file
</label><inputtype="file"id="file-input"></div>
Error handling
Example
Error message goes here
HTML Snippet for file upload error handling
<divclass="form-group form-group-error"><labelclass="form-label"for="file-input">
Upload a file
</label><spanclass="error-message">Error message goes here</span><inputtype="file"id="file-input"></div>
Multi file upload
Note: The below example is for CATs forms. There is no logic behind this as it has been done by DIS. Conditional logic to be used to show the .files div when files are present.