w3docs logo

HTML accept Attribute

The HTML accept attribute specifies the type of file that the server accepts. The submission is possible through a file upload.

You can only use this attribute on the <input> element. It is only used with <input type="file">.

The accept attribute must not be used as a validation tool. File uploads must be validated on the server.


<input accept="file_extension | audio/* | video/* | image/* | media_type">

Example of the HTML accept attribute:

<!DOCTYPE html>
    <title>Title of the document</title>
    <form action="/form/submit" method="post">
      <input type="file" name="Image" accept="image/*">
      <input type="submit">

Do you find this helpful?