For HTML forms. I am confused, I’m trying to set enctype=’application/octet-stream’ but the server receives the request with content-type =’application/x-www-form-urlencoded’ (the default value).
For HTML forms. I am confused, I’m trying to set enctype=’application/octet-stream’ but the server
Share
The
enctypeattribute specifies the content type (in HTTP terms, as indicated inContent-Typeheader) used by the browser when it submits the form data to server.However, the spec defines only two content types in this context,
application/x-www-form-urlencoded(the default) andmultipart/form-data, and adds: “Behavior for other content types is unspecified.” What happens in practice is that browsers silently ignoreenctypeattributes with other values, using the default. You can see this if you e.g. inspect the document in Firebug: inspecting theformelement, the DOM pane contains the propertyenctype—with the default value. It is common in web browsers to be silent about errors in markup.The type
application/octet-streamwould not be very useful in this context, since if the browser sent such information, it would be effectively saying “this is lump of binary data of unknown (or unspecified) structure”.