HTML <input> formenctype属性

❮HTML<input>タグ

デフォルトでエンコードされ(最初の送信ボタン)、「multipart / form-data」(2番目の送信ボタン)としてエンコードされたフォームデータを送信します。

<form action="/action_page_binary.asp" method="post">
  <label for="fname">First name:</label>
  <input type="text" id="fname" name="fname"><br><br>
  <input type="submit" value="Submit">
  <input type="submit" formenctype="multipart/form-data" value="Submit as Multipart/form-data">
</form>

定義と使用法

このformenctype属性は、フォームデータをサーバーに送信するときにどのようにエンコードするかを指定します(フォームの場合のみmethod="post"

この属性は、 要素formenctypeの属性をオーバーライドします。enctype<form>

注:formenctype属性はおよびで使用さ type="submit"ます type="image"


ブラウザのサポート

表の数字は、属性を完全にサポートする最初のブラウザーバージョンを示しています。

Attribute
formenctype Yes 10.0 Yes 5.1 10.6

構文

<input formenctype="value">

属性値

Value Description
application/x-www-form-urlencoded Default. All characters are encoded before sent (spaces are converted to "+" symbols, and special characters are converted to ASCII HEX values)
multipart/form-data  This value is necessary if the user will upload a file through the form
text/plain Sends data without any encoding at all. Not recommended

❮HTML<input>タグ