Short URL: http://html5.org/r/7057
| SVN | Bug | Comment | Time (UTC) |
|---|---|---|---|
| 7057 | 11482 | 2012-04-18 23:22 |
Index: source
===================================================================
--- source (revision 7056)
+++ source (revision 7057)
@@ -56414,6 +56414,10 @@
<dd>Indicates that files of the specified type are accepted.</dd>
+ <dt>A string whose first character is a U+002E FULL STOP character (.)</dt>
+
+ <dd>Indicates that files with the specified file extension are accepted.</dd>
+
</dl>
<p>The tokens must not be <span>ASCII case-insensitive</span>
@@ -56437,6 +56441,46 @@
</div>
+ <p class="note">Authors are encouraged to specify both any MIME
+ types and any corresponding extensions when looking for data in a
+ specific format.</p>
+
+ <div class="example">
+
+ <p>For example, consider an application that converts Microsoft
+ Word documents to Open Document Format files. Since Microsoft Word
+ documents are described with a wide variety of MIME types and
+ extensions, the site can list several, as follows:</p>
+
+ <pre><input type="file" accept=".doc .docx .xml application/msword application/vnd.openxmlformats-officedocument.wordprocessingml.document"></pre>
+
+ <p>On platforms that only use file extensions to describe file
+ types, the extensions listed here can be used to filter the allowed
+ documents, while the MIME types can be used with the system's type
+ registration table (mapping MIME types to extensions used by the
+ system), if any, to determine any other extensions to allow.
+ Similarly, on a system that does not have file names or extensions
+ but labels documents with MIME types internally, the MIME types can
+ be used to pick the allowed files, while the extensions can be used
+ if the system has an extension registration table that maps known
+ extensions to MIME types used by the system.</p>
+
+ </div>
+
+ <p class="warning">Extensions tend to be ambiguous (e.g. there are
+ an untold number of formats that use the "<code
+ title="">.dat</code>" extension, and users can typically quite
+ easily rename their files to have a "<code title="">.doc</code>"
+ extension even if they are not Microsoft Word documents), and MIME
+ types tend to be unreliable (e.g. many formats have no formally
+ registered types, and many formats are in practice labeled using a
+ number of different MIME types). Authors are reminded that, as
+ usual, data received from a client should be treated with caution,
+ as it may not be in an expected format even if the user is not
+ hostile and the user agent fully obeyed the <code
+ title="attr-input-accept">accept</code> attribute's
+ requirements.</p>
+
<div class="example" id="fakepath-srsly">
<p>For historical reasons, the <code