1---
2c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
3SPDX-License-Identifier: curl
4Long: remote-header-name
5Short: J
6Protocols: HTTP
7Help: Use the header-provided filename
8Category: output
9Added: 7.20.0
10Multi: boolean
11See-also:
12  - remote-name
13Example:
14  - -OJ https://example.com/file
15---
16
17# `--remote-header-name`
18
19Tell the --remote-name option to use the server-specified Content-Disposition
20filename instead of extracting a filename from the URL. If the server-provided
21filename contains a path, that is stripped off before the filename is used.
22
23The file is saved in the current directory, or in the directory specified with
24--output-dir.
25
26If the server specifies a filename and a file with that name already exists in
27the destination directory, it is not overwritten and an error occurs - unless
28you allow it by using the --clobber option. If the server does not specify a
29filename then this option has no effect.
30
31There is no attempt to decode %-sequences (yet) in the provided filename, so
32this option may provide you with rather unexpected filenames.
33
34This feature uses the name from the `filename` field, it does not yet support
35the `filename*` field (filenames with explicit character sets).
36
37**WARNING**: Exercise judicious use of this option, especially on Windows. A
38rogue server could send you the name of a DLL or other file that could be
39loaded automatically by Windows or some third party software.
40