HTML <input> formenctype- Attribut

❮ HTML <input>-Tag

Beispiel

Senden Sie Formulardaten, die standardmäßig codiert sind (die erste Schaltfläche zum Senden) und als „multipart/form-data“ codiert sind (die zweite Schaltfläche zum Senden):

<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>

Definition und Verwendung

Das formenctypeAttribut gibt an, wie die Formulardaten codiert werden sollen, wenn sie an den Server gesendet werden (nur für Formulare mit method="post")

Das formenctypeAttribut überschreibt das enctypeAttribut des <form>Elements.

Hinweis: Das formenctypeAttribut wird mit type="submit"und verwendet type="image".


Browser-Unterstützung

Die Zahlen in der Tabelle geben die erste Browserversion an, die das Attribut vollständig unterstützt.

Attribute
formenctype Yes 10.0 Yes 5.1 10.6

Syntax

<input formenctype="value">

Attributwerte

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>-Tag