Skip to content

Commit

Permalink
[giow] (0) Introduce extensions in accept=''.
Browse files Browse the repository at this point in the history
Fixing https://www.w3.org/Bugs/Public/show_bug.cgi?id=11482
Affected topics: HTML

git-svn-id: http://svn.whatwg.org/webapps@7057 340c8d12-0b0e-0410-8428-c7bf67bfef74
  • Loading branch information
Hixie committed Apr 18, 2012
1 parent 4c98a1d commit 9fda389
Show file tree
Hide file tree
Showing 3 changed files with 128 additions and 0 deletions.
42 changes: 42 additions & 0 deletions complete.html
Expand Up @@ -48451,6 +48451,10 @@ <h6 id="file-upload-state-(type=file)"><span class=secno>4.10.7.1.18 </span><dfn

<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 <a href=#ascii-case-insensitive>ASCII case-insensitive</a>
matches for any of the other tokens (i.e. duplicates are not
allowed). <span class=impl>To obtain the list of tokens from the
Expand All @@ -48471,6 +48475,44 @@ <h6 id="file-upload-state-(type=file)"><span class=secno>4.10.7.1.18 </span><dfn

</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>&lt;input type="file" accept=".doc .docx .xml application/msword application/vnd.openxmlformats-officedocument.wordprocessingml.document"&gt;</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><a href=#attr-input-accept>accept</a></code> attribute's
requirements.</p>

<div class=example id=fakepath-srsly>

<p>For historical reasons, the <code title=dom-input-value><a href=#dom-input-value>value</a></code> IDL attribute prefixes the
Expand Down
42 changes: 42 additions & 0 deletions index
Expand Up @@ -48451,6 +48451,10 @@ interface <dfn id=htmlformelement>HTMLFormElement</dfn> : <a href=#htmlelement>H

<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 <a href=#ascii-case-insensitive>ASCII case-insensitive</a>
matches for any of the other tokens (i.e. duplicates are not
allowed). <span class=impl>To obtain the list of tokens from the
Expand All @@ -48471,6 +48475,44 @@ interface <dfn id=htmlformelement>HTMLFormElement</dfn> : <a href=#htmlelement>H

</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>&lt;input type="file" accept=".doc .docx .xml application/msword application/vnd.openxmlformats-officedocument.wordprocessingml.document"&gt;</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><a href=#attr-input-accept>accept</a></code> attribute's
requirements.</p>

<div class=example id=fakepath-srsly>

<p>For historical reasons, the <code title=dom-input-value><a href=#dom-input-value>value</a></code> IDL attribute prefixes the
Expand Down
44 changes: 44 additions & 0 deletions source
Expand Up @@ -56414,6 +56414,10 @@ interface <dfn>HTMLFormElement</dfn> : <span>HTMLElement</span> {

<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>
Expand All @@ -56437,6 +56441,46 @@ interface <dfn>HTMLFormElement</dfn> : <span>HTMLElement</span> {

</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>&lt;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
Expand Down

0 comments on commit 9fda389

Please sign in to comment.