aboutsummaryrefslogtreecommitdiff
path: root/files/ja/web/api/formdata/append
diff options
context:
space:
mode:
authorPeter Bengtsson <mail@peterbe.com>2020-12-08 14:40:17 -0500
committerPeter Bengtsson <mail@peterbe.com>2020-12-08 14:40:17 -0500
commit33058f2b292b3a581333bdfb21b8f671898c5060 (patch)
tree51c3e392513ec574331b2d3f85c394445ea803c6 /files/ja/web/api/formdata/append
parent8b66d724f7caf0157093fb09cfec8fbd0c6ad50a (diff)
downloadtranslated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.gz
translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.bz2
translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.zip
initial commit
Diffstat (limited to 'files/ja/web/api/formdata/append')
-rw-r--r--files/ja/web/api/formdata/append/index.html101
1 files changed, 101 insertions, 0 deletions
diff --git a/files/ja/web/api/formdata/append/index.html b/files/ja/web/api/formdata/append/index.html
new file mode 100644
index 0000000000..ce9f9e731f
--- /dev/null
+++ b/files/ja/web/api/formdata/append/index.html
@@ -0,0 +1,101 @@
+---
+title: FormData.append()
+slug: Web/API/FormData/append
+translation_of: Web/API/FormData/append
+---
+<p>{{APIRef("XMLHttpRequest")}}</p>
+
+<p>インターフェイスの<code><strong>append()</strong></code>メソッドは、FormDataオブジェクト内の既存のキーに新しい値を追加するか、キーがまだ存在しない場合は追加します。</p>
+
+<p>{{domxref("FormData.set")}}との違いは、指定されたキーが既に存在する場合、{{domxref("FormData.set")}}はすべての既存の値を新しい値で上書きすることです。 一方、<code>append()</code>は、既存の値のセットの最後に新しい値を追加します。</p>
+
+<div class="note">
+<p><strong>注:このメソッドはWeb Workersで使用できます。</strong></p>
+</div>
+
+<h2 id="Syntax">Syntax</h2>
+
+<p>There are two versions of this method: a two and a three parameter version:</p>
+
+<pre class="brush: js">formData.append(name, value);
+formData.append(name, value, filename);</pre>
+
+<h3 id="append_Parameters" name="append()_Parameters">Parameters</h3>
+
+<dl>
+ <dt><code>name</code></dt>
+ <dd>The name of the field whose data is contained in <code>value</code>.</dd>
+ <dt><code>value</code></dt>
+ <dd>The field's value. This can be a {{domxref("USVString")}} or {{domxref("Blob")}} (including subclasses such as {{domxref("File")}}). If none of these are specified the value is converted to a string.</dd>
+ <dt><code>filename </code>{{optional_inline}}</dt>
+ <dd>The filename reported to the server (a {{domxref("USVString")}}), when a {{domxref("Blob")}} or {{domxref("File")}} is passed as the second parameter. The default filename for {{domxref("Blob")}} objects is "blob". The default filename for {{domxref("File")}} objects is the file's filename.</dd>
+</dl>
+
+<div class="note">
+<p><strong>Note:</strong> If you specify a {{domxref("Blob")}} as the data to append to the <code>FormData</code> object, the filename that will be reported to the server in the "Content-Disposition" header used to vary from browser to browser.</p>
+</div>
+
+<h3 id="Returns">Returns</h3>
+
+<p>Void.</p>
+
+<h2 id="Example">Example</h2>
+
+<p>The following line creates an empty <code>FormData</code> object:</p>
+
+<pre class="brush: js">var formData = new FormData(); // Currently empty</pre>
+
+<p>You can add key/value pairs to this using {{domxref("FormData.append")}}:</p>
+
+<pre class="brush: js">formData.append('username', 'Chris');
+formData.append('userpic', myFileInput.files[0], 'chris.jpg');</pre>
+
+<p>As with regular form data, you can append multiple values with the same name. For example (and being compatible with PHP's naming conventions by adding [] to the name):</p>
+
+<pre class="brush: js">formData.append('userpic[]', myFileInput.files[0], 'chris1.jpg');
+formData.append('userpic[]', myFileInput.files[1], 'chris2.jpg');</pre>
+
+<p>This technique makes it simpler to process multi-file uploads because the resultant data structure is more conducive to looping.</p>
+
+<p>If the sent value is different than String or Blob it will be automatically converted to String:</p>
+
+<pre class="brush: js">formData.append('name', true);
+formData.append('name', 74);
+formData.append('name', 'John');
+
+formData.getAll('name'); // ["true", "74", "John"]
+</pre>
+
+<h2 id="Specifications">Specifications</h2>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <th scope="col">Specification</th>
+ <th scope="col">Status</th>
+ <th scope="col">Comment</th>
+ </tr>
+ <tr>
+ <td>{{SpecName('XMLHttpRequest','#dom-formdata-append','append()')}}</td>
+ <td>{{Spec2('XMLHttpRequest')}}</td>
+ <td>Initial definition</td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="ブラウザの互換性">ブラウザの互換性</h2>
+
+<div class="hidden">このページの互換性テーブルは、構造化データから生成されます。 データに貢献したい場合は、<a href="https://github.com/mdn/browser-compat-data">https://github.com/mdn/browser-compat-data</a>をチェックして、プルリクエストを送信してください。</div>
+
+<div class="hidden"></div>
+
+<div class="hidden"></div>
+
+<h2 id="See_also">See also</h2>
+
+<ul>
+ <li>{{domxref("XMLHTTPRequest")}}</li>
+ <li><a href="/en-US/docs/DOM/XMLHttpRequest/Using_XMLHttpRequest" title="Using XMLHttpRequest">Using XMLHttpRequest</a></li>
+ <li><a href="/en-US/docs/DOM/XMLHttpRequest/FormData/Using_FormData_Objects" title="DOM/XMLHttpRequest/FormData/Using_FormData_objects">Using FormData objects</a></li>
+ <li>{{HTMLElement("Form")}}</li>
+</ul>