By change I discovered that the django admin interfaces uses enctype="multipart/form-data"
always.
I would like to adopt this pattern, but I am unsure if I see all consequences this has.
Why not use enctype="multipart/form-data"
always?
Since more than one year we use enctype="multipart/form-data"
always in some forms. Works fine.
From the RFC that defines multipart/form-data
:
Many web applications use the "application/x-www-form-urlencoded" method for returning data from forms. This format is quite compact, for example:
name=Xavier+Xantico&verdict=Yes&colour=Blue&happy=sad&Utf%F6r=Send
However, there is no opportunity to label the enclosed data with a content type, apply a charset, or use other encoding mechanisms.
Many form-interpreting programs (primarily web browsers) now implement and generate multipart/form-data, but a receiving application might also need to support the "application/x-www-form-urlencoded" format.
Aside from letting you upload files, multipart/form-data
also allows you to use other charsets and encoding mechanisms. So the only reasons not to use it are:
If you want to save a bit of bandwidth (bearing in mind that this becomes much less of an issue if the request body is compressed).
If you need to support really old clients that can't handle file uploads and only know application/x-www-form-urlencoded
, or that have issues handling anything other than ASCII.