W3C home > Mailing lists > Public > public-html-diffs@w3.org > April 2012

hixie: Introduce extensions in accept=''. (whatwg r7057)

From: poot <cvsmail@w3.org>
Date: Wed, 18 Apr 2012 19:23:07 -0400
To: public-html-diffs@w3.org
Message-Id: <E1SKeDL-00068B-PY@jay.w3.org>
hixie: Introduce extensions in accept=''. (whatwg r7057)

http://dev.w3.org/cvsweb/html5/spec/Overview.html?r1=1.5626&r2=1.5627&f=h
http://html5.org/tools/web-apps-tracker?from=7056&to=7057

===================================================================
RCS file: /sources/public/html5/spec/Overview.html,v
retrieving revision 1.5626
retrieving revision 1.5627
diff -u -d -r1.5626 -r1.5627
--- Overview.html	18 Apr 2012 06:57:57 -0000	1.5626
+++ Overview.html	18 Apr 2012 23:22:49 -0000	1.5627
@@ -41697,6 +41697,10 @@
 
    <dd>Indicates that files of the specified type are accepted.</dd>
 
+   <dt>A string whose first character is a "." (U+002E) 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
@@ -41717,6 +41721,44 @@
 
   </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
Received on Wednesday, 18 April 2012 23:23:15 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 18 April 2012 23:23:16 GMT