Skip to content

Official government website An official website of the Federal Government of Nigeria

How you know
Federal Ministry of Communications, Innovation & Digital Economy Nigerian Design Standards

File upload

Lets people attach a file from their device, like a photo of an ID card or a scanned letter. A multiple version lets people add several files to one question.

Updated

Live example

File upload
national-id-card.pdf PDF, 1.2MB

PDF, JPG or PNG. Maximum 5MB.

national-id-card.pdf selected

Controls
Property Control What it does
Default, selected, error, disabled or too many files
Says what to upload
One file or several

Overview

Use a file upload when a service needs a document as evidence, like an ID, proof of address or a certificate. Ask one question per document, and say the file types and maximum size in the hint.

Use a file upload for

  • A document as evidence: ID, proof of address, a certificate
  • One document per question
  • Several files for one question, with the multiple version

Don’t use a file upload for

  • Information people could type, like a reference number
  • Drag and drop as the only way to add a file
  • A hidden input with a div as the button

States

One file or several. Each has default, selected, error and disabled states; the multiple version adds a list of files.

No file chosen or drag and drop it here

PDF, JPG or PNG. Maximum 5MB.

Default

Nothing chosen yet: the button and the drop text.

national-id-card.pdf PDF, 1.2MB

PDF, JPG or PNG. Maximum 5MB.

national-id-card.pdf selected

Selected

The file name and size, a Remove button, and Change file.

passport-scan.heic HEIC, 2.1MB

PDF, JPG or PNG. Maximum 5MB.

passport-scan.heic selected

Error

An error message, icon and red border. The file name stays on screen.

No file chosen or drag and drop it here

PDF, JPG or PNG. Maximum 5MB.

Disabled

Can’t be used. Avoid it where you can and say why instead.

Specifications

The properties of the file upload. The same in HTML, WordPress and React.

File upload properties
Property Type Possible values Description
label string
  • any text
Required. Says what to upload.
accept string
  • .pdf default
  • .jpg
  • .png
File types people can choose. Say them in the hint too.
maxSize string
  • 5MB, or the limit for your service
Checked when a file is chosen, and again on submit.
multiple boolean
  • false default
  • true
Shows a list of files. Set the limit with maxFiles.

In code, use a real <input type="file"> with <label for>, and aria-describedby pointing to the hint and the error. Announce the chosen file in a polite live region, like “national-id-card.pdf selected”. Never replace the input with a div.

Tokens

File upload tokens and contrast
Part Token Contrast on the page
Container Upload area · surface/canvas · border/strong 1px 4.2:1
File name Body/medium-emphasized · text/primary 17.6:1
Hint and file size Body/small · text/secondary 6.6:1
Remove Button, Icon only, Small, with icon/Close Uses standard Button tokens
Error status/error/surface: text, icon and border 4.9:1
Disabled text/disabled Not required

Use cases

Do

No file chosen or drag and drop it here

PDF, JPG or PNG. Maximum 5MB.

When several files land on a one-file field, add none and say why.

Don’t

No file chosen or drag and drop it here

PDF, JPG or PNG. Maximum 5MB.

Don’t rely on drag and drop. The button must always work.

Layout

How a file upload sits in a form.

Fills the column
The upload area is as wide as the other fields.
File name wraps
When space runs out, it wraps under the button. It’s never cut off.
One tab stop
Choose file, then Remove once a file is chosen.
Drag and drop on desktop
An extra on top of the button. Turn the drop text off on mobile.
Files in order
In the multiple version, new files go below the ones already there.

Copywriting

How to write hints and error messages.

Put the limit in the hint

“Up to 5 files. PDF, JPG or PNG, up to 5MB each.”

Use numbers
“1 file”, not “a file”.
Say why a file wasn’t added

“Not added. The file must be smaller than 5MB.”

Name the file

“Remove national-id-card.pdf”, so people know which one.

Say what to do next

“Try again” or “Choose a different file”.

Keep the file name on screen

So people can see which file was wrong.

Examples

File upload copywriting examples
Write Don’t write Why
Select your ID document This field is required Says what to do.
The selected file must be a PDF, JPG or PNG Invalid file type Names the types allowed.
Up to 5 files. PDF, JPG or PNG, up to 5MB each. Allowed types: pdf, jpg, png Put the limit in the hint.
Not added. The file must be smaller than 5MB. File too large Say why a file wasn’t added.
The file could not be uploaded. Try again Upload failed (500) Say what to do next.

Accessibility

Meaning never relies on colour alone: an error has an icon and text, and the chosen file is named in words.

Keyboard interaction for file upload
Key What it does
Tab Moves to Choose file (one tab stop), then to Remove once a file is chosen.
Shift + Tab Moves back.
Enter or Space Opens the file picker; on phones it offers camera, photos and files. On Remove, removes the file and moves focus back to Choose file.
  • A real <input type="file"> with <label for>, described by the hint and the error (WCAG 1.3.1, 3.3.2).
  • The chosen file is announced politely: “national-id-card.pdf, PDF, 1.2MB selected” (WCAG 4.1.3).
  • Each Remove button names its file, like “Remove national-id-card.pdf” (WCAG 2.4.6, 4.1.2).
  • Errors use an icon and text, not colour alone, and the file name stays on screen (WCAG 1.4.1, 3.3.1).
  • Drag and drop is never the only way: the button always works (WCAG 2.5.7).

For developers

Copy the code for HTML, WordPress or React from the Code tab in Live example. The options are listed under Specifications.

For designers

Use Form/File upload from 01 Library – Foundations. Keep a real file input in the markup.

References

Feedback

Report a problem with this page