HTMLFormElement: enctype プロパティ

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.

HTMLFormElement.enctype プロパティは、サーバーにフォームを送信するために使用されるコンテンツの MIME タイプを指定します。使用可能な値は以下の通りです。

  • application/x-www-form-urlencoded: 初期値(既定値)です。
  • multipart/form-data: <input> 要素にファイルデータをアップロードできるようにする型。
  • text/plain: 形式があいまいで、人間が読み取り可能なコンテンツであり、コンピューターで確実に解釈できるとは限りません。

この値は formenctype 属性を <button> または <input> 要素に指定することで上書きすることができます。

文字列です。

js
form.enctype = "application/x-www-form-urlencoded";

仕様書

Specification
HTML
# dom-fs-enctype

ブラウザーの互換性

Report problems with this compatibility data on GitHub
desktopmobile
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
enctype

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support