CINXE.COM

file 路 WebPlatform Docs

<!DOCTYPE html> <html lang="en" dir="ltr" class="client-nojs with-toc"> <head> <meta charset="UTF-8" /> <title>file 路 WebPlatform Docs</title> <link rel="stylesheet" href="/assets/css/docs.css" /> <link rel="stylesheet" href="/assets/css/highlight.css" /> <link rel="shortcut icon" href="/favicon.ico" /> <meta name="viewport" content="width=device-width" /> <!--[if lt IE 7]><script src="/bower_components/ie7-js/lib/IE7.js"></script><![endif]--> <!--[if lt IE 8]><script src="/bower_components/ie7-js/lib/IE8.js"></script><![endif]--> <!--[if lt IE 9]><script src="/bower_components/ie7-js/lib/IE9.js"></script><![endif]--> <!--[if lt IE 8]><link rel="stylesheet" href="/assets/css/ie7.css"><![endif]--> <meta property="readiness" content="Ready to Use" /> <meta property="standardization" content="W3C Working Draft" /> <meta name="description" content="The File API allows a developer to use javascript to access the contents and local path of a file uploaded from the input file widget. This enables the developer to build a javascript frontend that allows the website to show a preview of the file uploaded. By using the File API, the developer can also enable a user to upload files via drag-and-drop. Prior to the File API, functionalities like these can only be accomplished via Flash or other plugins." /> <script src="/bower_components/jquery/dist/jquery.min.js"></script> <script src="/bower_components/vue/dist/vue.min.js"></script> </head> <body class="mediawiki ltr sitedir-ltr skin-webplatform action-view"> <div class="readiness-state Ready_to_Use"><p>This page is <a>Ready to Use</a></p></div> <header id="mw-head" class="noprint"> <div class="container"> <div id="p-logo"> <a href="/" title="Visit the home page"></a> </div> </div> </header> <nav id="sitenav"> <div class="container"> <ul class="links"> <li><a href="/" class="active">THE DOCS</a></li> <li><a href="/docs/Community">CONNECT</a></li> <li><a href="/docs/WPD/Contributors_Guide/">CONTRIBUTE</a></li> <li><a href="/blog/">BLOG</a></li> </ul> </div> </nav> <div id="siteNotice"> <div id="localNotice" dir="ltr" lang="en"> <div class="notice" style="margin:10px auto; position: relative; width: 90%; max-width: 950px;"> <div style="padding: 10px; border-radius: 4px; background-color: rgb(249, 247, 243); box-shadow: 0px 0px 1px rgb(167, 169, 172);"> <strong>Notice:</strong>&nbsp;The WebPlatform project, supported by various stewards between 2012 and 2015, has been <b>discontinued</b>. This site is now available on <a href="https://github.com/webplatform/webplatform.github.io/">github</a>. </div> </div> </div> </div> <div id="content" class="mw-body"> <div class="container"> <a id="top"></a> <div class="tool-area"> <div id="hierarchy-menu"> <ol id="breadcrumb-info" class="breadcrumbs"> <li><a href="/">DOCS</a></li> <li><a href="/docs/apis/">apis</a></li><li><a href="/docs/apis/file/">file</a></li> </ol> </div> </div> <div id="page"> <div id="page-content"> <div id="main-content"> <h1>file</h1> <h2>Summary</h2> <p>The File API allows a developer to use javascript to access the contents and local path of a file uploaded from the input file widget. This enables the developer to build a javascript frontend that allows the website to show a preview of the file uploaded. By using the File API, the developer can also enable a user to upload files via drag-and-drop. Prior to the File API, functionalities like these can only be accomplished via Flash or other plugins.</p> <dl> <dt><a href="/docs/apis/file/Blob">Blob</a></dt> <dd>The <strong>Blob</strong> object represents immutable raw data. It provides a method to slice data objects between ranges of bytes into further chunks of raw data. </dd> <dt><a href="/docs/apis/file/File">File</a></dt> <dd>The <strong>File</strong> object provides information about files stored on the user鈥檚 computer, and access to their contents. These are generally retrieved from a <a href="/docs/apis/file/FileList">FileList</a> object returned when a user selects files using the <strong>input</strong> element, or from a drag-and-drop operation鈥檚 <strong>DataTransfer</strong> object. </dd> <dt><a href="/docs/apis/file/FileError">FileError</a></dt> <dd>Represents an error that occurs while using the FileReader interface. Obsolete per latest specification. Use <a href="/docs/dom/DOMError">DOMError</a> instead. </dd> <dt><a href="/docs/apis/file/FileList">FileList</a></dt> <dd>FileList is an object which represents an array of individually selected files from the underlying system. </dd> <dt><a href="/docs/apis/file/FileReader">FileReader</a></dt> <dd>The <strong>FileReader</strong> object lets web applications asynchronously read the contents of files (or raw data buffers) stored on the user鈥檚 computer, using File or Blob objects to specify the file or data to read. File objects may be obtained from a FileList object returned as a result of a user selecting files using the <em>input</em> element, from a drag-and-drop operation鈥檚 <em>DataTransfer</em> object, or from the <em>mozGetAsFile() API</em> on an <em>HTMLCanvasElement</em>. </dd> <dt><a href="/docs/apis/file/FileReaderSync">FileReaderSync</a></dt> <dd>Allows for synchronous reading of File or Blob objects. Only available in Workers, as synchronous I/O would otherwise block the main application from executing. </dd> <dt><a href="/docs/apis/file/MSStreamError">MSStreamError</a></dt> <dd>The MSStreamError object reports file-related errors asynchronously. Obsolete per latest specification. Use <a href="/docs/dom/DOMError">DOMError</a> instead. </dd> <dt><a href="/docs/apis/file/MSStreamReader">MSStreamReader</a></dt> <dd>Creates random access data (Blob) from an MSStream object. </dd> <dt><a href="/docs/apis/file/ObjectURLOptions">ObjectURLOptions</a></dt> <dd>Provides the <em>oneTimeOnly</em> property for use with the <em>createObjectURL</em> method. </dd> <dt><a href="/docs/apis/file/URL">URL</a></dt> <dd>A static object for URL related utility operations. </dd> </dl> <h2>See also</h2> <h3>Related articles</h3> <h4>Off-line Storage</h4> <ul> <li><p><a href="/docs/apis/appcache">appcache</a></p></li> <li><p><a href="/docs/apis/appcache/ApplicationCache/status">status</a></p></li> <li><p><strong>file</strong></p></li> <li><p><a href="/docs/apis/filesystem">File System API</a></p></li> <li><p><a href="/docs/apis/quota_management">quota management</a></p></li> <li><p><a href="/docs/apis/quota_management/queryUsageAndQuota">queryUsageAndQuota</a></p></li> <li><p><a href="/docs/apis/quota_management/requestQuota">requestQuota</a></p></li> <li><p><a href="/docs/apis/web-storage/Storage/localStorage">localStorage</a></p></li> <li><p><a href="/docs/tutorials/appcache_beginner">Introduction to using the application cache</a></p></li> </ul> <!-- Attributions: None declared for this document. --> </div> <div class="topics-nav"> <ul> <li><a href="/docs/Beginners">Beginners</a></li> <li><a href="/docs/concepts">Concepts</a></li> <li><a href="/docs/html">HTML</a></li> <li><a href="/docs/css">CSS</a></li> <li><a href="/docs/concepts/accessibility">Accessibility</a></li> <li><a href="/docs/javascript">JavaScript</a></li> <li><a href="/docs/dom">DOM</a></li> <li><a href="/docs/svg">SVG</a></li> </ul> </div> <div class="clear"></div> </div> </div> </div> </div> <footer id="mw-footer"> <div class="container"> <div id="footer-wordmark"> <a href="https://github.com/webplatform/docs/blob/master/LICENSE.md" class="license"> <img src="/assets/cc-by-black.svg" width="120" height="42" alt="Content available under CC-BY, except where otherwise noted."> </a> <a href="/"><span id="footer-title">WebPlatform<span id="footer-title-light">.org</span></span></a> </div> <!-- ul class="stewards"> <li class="steward-w3c"><a href="/stewards/w3c">W3C</a></li> </ul --> </div> </footer> <script src="/assets/js/docs.js"></script> </body> </html>

Pages: 1 2 3 4 5 6 7 8 9 10