• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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
19This option tells the --remote-name option to use the server-specified
20Content-Disposition filename instead of extracting a filename from the URL. If
21the server-provided file name contains a path, that is stripped off before the
22file name is used.
23
24The file is saved in the current directory, or in the directory specified with
25--output-dir.
26
27If the server specifies a file name and a file with that name already exists
28in the destination directory, it is not overwritten and an error occurs -
29unless you allow it by using the --clobber option. If the server does not
30specify a file name then this option has no effect.
31
32There is no attempt to decode %-sequences (yet) in the provided file name, so
33this option may provide you with rather unexpected file names.
34
35This feature uses the name from the "filename" field, it does not yet support
36the "filename*" field (filenames with explicit character sets).
37
38**WARNING**: Exercise judicious use of this option, especially on Windows. A
39rogue server could send you the name of a DLL or other file that could be
40loaded automatically by Windows or some third party software.
41