htmldjangoenctype

Why not use enctype="multipart/form-data" always?


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?

Update

Since more than one year we use enctype="multipart/form-data" always in some forms. Works fine.


Solution

  • 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: