What does enctype=’multipart/form-data’ mean in an HTML form?


You have a form tag that contains the attribute enctype='multipart/form-data'. What does it mean in an HTML form and when should we use it?


The enctype attribute specifies how the form-data should be encoded when submitting it to the server. There are three methods of encoding. These are-

  • application/x-www-form-urlencoded (default value)
  • multipart/form-data
  • text/plain

Meaning: “multipart/form-data” explains that no characters are encoded (Encoding is that spaces are converted to “+” symbols, and special characters are converted to ASCII HEX values).


  • Use this, if you want to control file upload in your form tag of your page.
  • When your form includes  <input type= “file”> element.

The code:

<form action="demo.asp" method="post" enctype="multipart/form-data">
    First name: <input type="file" name="fname">