Debian Codegraph @

www/src/content/reference/01-attributes/18-hx-encoding.md

raw symbols SCIP
1 ---
2 title: "hx-encoding"
3 description: "Sets the request encoding type"
4 ---
5
6 The `hx-encoding` attribute allows you to switch the request encoding from the usual `application/x-www-form-urlencoded`
7 encoding to `multipart/form-data`, usually to support file uploads in an ajax request.
8
9 ## Syntax
10
11 ```html
12 <form hx-post="/upload" hx-encoding="multipart/form-data">
13 <input type="file" name="file">
14 <button type="submit">Upload</button>
15 </form>
16 ```
17
18 The value of this attribute should be `multipart/form-data`.
19
20 The `hx-encoding` tag may be placed on parent elements.