What HTML attribute specifies the file types a file input can accept?

The story behind the answer

The HTML `accept` attribute specifies the file types that a file input may accept from the user.

It is used with `<input type="file">` and can list MIME types, filename extensions, or broad categories such as `image/*`. For example, `accept="image/png,image/jpeg"` suggests that the file picker should show or prioritize those image formats. The browser uses this information when presenting the chooser, but it is not a security boundary.

Developers often confuse `accept` with `type`, which determines that the control is a file picker, or with `multiple`, which permits selecting more than one file. A server must still validate the uploaded file’s contents, because users and clients can bypass the browser’s suggested filtering.

Source: Wikipedia · fact-checked Aug. 2026

Add question to a list

Choose a list to keep this question in: