html – Performance com multipart/form-data


Regardless of the server-side language used (php, asp, jsf, etc), is there any problem with adding the enctype="multipart/form-data" attribute even in forms on pages that do n't upload a file?

Because I use a template (template) in an application and the form tag is in the template. As only some pages upload, the attribute will appear on all pages, even those that don't upload.


According to this question on Stack Overflow , there are three values ​​you can pass in enctype:

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

The general rule of thumb is: if you are uploading files, use multipart/form-data ; otherwise, use application/x-www-form-urlencoded . Never use text/plain .

Answering your question: when you don't attach any type of file to your form, I think it's best to use multipart/form-data . This format uses fewer bytes than application/x-www-form-urlencoded . Therefore, the server-side processing must also be smaller as it is handling a smaller string.

Scroll to Top