/

HTML / CSS / JavaScript Tutorial

HTML Standard attribute: accept

[this page | pdf | back links]

The HTML accept attribute specifies the types of file accepted by the server. It applies to <input> elements but only if type = file (and, prior to HTML 5, to <area> elements).

 

Valid attribute values (when used with <area> elements) include:

 

Value

Description

file_type

Not supported in HTML 5. Alternative text to display

 

Valid attribute values (when used with <input> elements) include:

 

Value

Description

file_extension

A file extension starting with a full stop, e.g. .png, .jpg, .pdf, .doc

media_type

A valid media type, see e.g. http://www.iana.org/assignments/media-types/media-types.xhtml

audio/*

Indicates any audio (sound) file is acceptable

image/*

Indicates any image file is acceptable

video/*

Indicates any video file is acceptable

 

More than one value can applied, if separated by commas.

 


NAVIGATION LINKS
Contents | Prev | Next | HTML Attributes


Desktop view | Switch to Mobile