aboutsummaryrefslogtreecommitdiff
path: root/files/ja/web/api/file/getasdataurl/index.md
diff options
context:
space:
mode:
Diffstat (limited to 'files/ja/web/api/file/getasdataurl/index.md')
-rw-r--r--files/ja/web/api/file/getasdataurl/index.md68
1 files changed, 68 insertions, 0 deletions
diff --git a/files/ja/web/api/file/getasdataurl/index.md b/files/ja/web/api/file/getasdataurl/index.md
new file mode 100644
index 0000000000..4d73665494
--- /dev/null
+++ b/files/ja/web/api/file/getasdataurl/index.md
@@ -0,0 +1,68 @@
+---
+title: File.getAsDataURL()
+slug: Web/API/File/getAsDataURL
+tags:
+ - API
+ - File API
+ - Obsolete
+ - Reference
+ - ファイル
+ - メソッド
+ - 廃止
+ - 非標準
+translation_of: Web/API/File/getAsDataURL
+---
+<div>{{APIRef("File API") }}</div>
+
+<p>{{non-standard_header}}</p>
+
+<p>{{deprecated_header(7.0)}}</p>
+
+<h2 id="Summary" name="Summary">概要</h2>
+
+<p>getAsDataURL は、参照されるファイルの内容全体をエンコードした <a href="/ja/docs/data_URIs"><code>data:</code></a> URL を提供します。</p>
+
+<div class="note">
+<p><strong>メモ:</strong> このメソッドは廃止されました。代わりに {{domxref("FileReader")}} の {{domxref("FileReader.readAsDataURL","readAsDataURL()")}} メソッドを使用する必要があります。</p>
+</div>
+
+<h2 id="Syntax" name="Syntax">構文</h2>
+
+<pre>var url = <var>instanceOfFile</var>.getAsDataURL();</pre>
+
+<h3 id="Returns" name="Returns">返値</h3>
+
+<p><a href="/ja/docs/data_URIs"><code>data:</code></a> URL を表す文字列</p>
+
+<h2 id="Example" name="Example">例</h2>
+
+<pre class="brush: js">// fileInput is a HTMLInputElement: &lt;input type="file" id="myfileinput" multiple&gt;
+var fileInput = document.getElementById("myfileinput");
+
+// files is a FileList object (similar to NodeList)
+var files = fileInput.files;
+
+// array with acceptable file types
+var accept = ["image/png"];
+
+// img is a HTMLImgElement: &lt;img id="myimg"&gt;
+var img = document.getElementById("myimg");
+
+// if we accept the first selected file type
+if (accept.indexOf(files[0].mediaType) &gt; -1) {
+ // display the image
+ // same as &lt;img src="data:image/png,&lt;imagedata&gt;"&gt;
+ img.src = files[0].getAsDataURL();
+}
+</pre>
+
+<h2 id="Specification" name="Specification">仕様書</h2>
+
+<p>どの仕様書にも含まれていません。</p>
+
+<h2 id="See_also" name="See_also">関連情報</h2>
+
+<ul>
+ <li>{{domxref("File")}}</li>
+ <li>{{domxref("FileReader")}}</li>
+</ul>