• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1---
2c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
3SPDX-License-Identifier: curl
4Long: data-urlencode
5Arg: <data>
6Help: HTTP POST data URL encoded
7Protocols: HTTP
8Added: 7.18.0
9Category: http post upload
10Multi: append
11See-also:
12  - data
13  - data-raw
14Example:
15  - --data-urlencode name=val $URL
16  - --data-urlencode =encodethis $URL
17  - --data-urlencode name@file $URL
18  - --data-urlencode @fileonly $URL
19---
20
21# `--data-urlencode`
22
23This posts data, similar to the other --data options with the exception
24that this performs URL-encoding.
25
26To be CGI-compliant, the <data> part should begin with a *name* followed
27by a separator and a content specification. The <data> part can be passed to
28curl using one of the following syntaxes:
29
30## content
31This makes curl URL-encode the content and pass that on. Just be careful
32so that the content does not contain any = or @ symbols, as that makes
33the syntax match one of the other cases below!
34
35## =content
36This makes curl URL-encode the content and pass that on. The preceding =
37symbol is not included in the data.
38
39## name=content
40This makes curl URL-encode the content part and pass that on. Note that
41the name part is expected to be URL-encoded already.
42
43## @filename
44This makes curl load data from the given file (including any newlines),
45URL-encode that data and pass it on in the POST.
46
47## name@filename
48This makes curl load data from the given file (including any newlines),
49URL-encode that data and pass it on in the POST. The name part gets an equal
50sign appended, resulting in *name=urlencoded-file-content*. Note that the
51name is expected to be URL-encoded already.
52