htmx/www/content/attributes/hx-encoding.md
William Jackson 46badfe0b1
Add descriptions for attribute pages (#3158)
Descriptions for attribute pages
2025-02-07 17:07:13 -07:00

682 B

+++ title = "hx-encoding" description = """
The hx-encoding attribute in htmx allows you to switch the request encoding from the usual
application/x-www-form-urlencoded encoding to multipart/form-data, usually to support file uploads in an AJAX
request.""" +++

The hx-encoding attribute allows you to switch the request encoding from the usual application/x-www-form-urlencoded encoding to multipart/form-data, usually to support file uploads in an ajax request.

The value of this attribute should be multipart/form-data.

The hx-encoding tag may be placed on parent elements.

Notes

  • hx-encoding is inherited and can be placed on a parent element