HTML Attributes

HTML enctype attribute

Build a form with the HTML form generator

Controls form data encoding for POST submissions. Use multipart/form-data for file uploads. The default is application/x-www-form-urlencoded; text/plain is not robust for normal production use. Applicable elements include: <form>. Check each element’s value rules. Example uses illustrative URLs or local assets; provide the corresponding files or application endpoints when running it.

Formal Syntax & Structure

html syntaxhtml
enctype="multipart/form-data"

Parameters & Attributes

NameTypeDescription
enctypeenumerated: application/x-www-form-urlencoded, multipart/form-data, text/plainControls form data encoding for POST submissions. Use multipart/form-data for file uploads. The default is application/x-www-form-urlencoded; text/plain is not robust for normal production use.

Working Example

Example Snippethtml
<form method="post" enctype="multipart/form-data" action="/upload">  <label>    File    <input type="file" name="file">  </label>  <button>Upload</button></form>
HTML Reference