IE automatically adding enctype="application/x-www-form-urlencoded". Why?

I’m building a simple form with Javascript and I set the enctype to “multipart/form-data”.

var form = document.createElement('form');
form.setAttribute('method', 'post');
form.setAttribute('enctype', 'multipart/form-data');
form.setAttribute('action', 'index.aspx');
form.setAttribute('onsubmit', 'return verifyForm()');

The form in Chrome/Firefox/Safari:

<form method="post" enctype="multipart/form-data" action="index.aspx" onsubmit="return verifyForm()">

The form in IE:

<form onsubmit="return verifyForm()" encType="application/x-www-form-urlencoded" method=post action=index.aspx enctype="multipart/form-data">

Why would this happen?

I looked into this because for some reason my files are not being sent to index.aspx when using IE and I think this could probably be causing that issue.


Found out why.

Apparently in IE, you have to set the “encoding” of the form rather than the “enctype”.

Thanks for making things more difficult, Microsoft.