• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1---
2c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
3SPDX-License-Identifier: curl
4Long: upload-file
5Short: T
6Arg: <file>
7Help: Transfer local FILE to destination
8Category: important upload
9Added: 4.0
10Multi: append
11See-also:
12  - get
13  - head
14  - request
15  - data
16Example:
17  - -T file $URL
18  - -T "img[1-1000].png" ftp://ftp.example.com/
19  - --upload-file "{file1,file2}" $URL
20---
21
22# `--upload-file`
23
24This transfers the specified local file to the remote URL.
25
26If there is no file part in the specified URL, curl appends the local file
27name to the end of the URL before the operation starts. You must use a
28trailing slash (/) on the last directory to prove to curl that there is no
29file name or curl thinks that your last directory name is the remote file name
30to use.
31
32When putting the local file name at the end of the URL, curl ignores what is
33on the left side of any slash (/) or backslash (\) used in the file name and
34only appends what is on the right side of the rightmost such character.
35
36Use the file name "-" (a single dash) to use stdin instead of a given file.
37Alternately, the file name "." (a single period) may be specified instead of
38"-" to use stdin in non-blocking mode to allow reading server output while
39stdin is being uploaded.
40
41If this option is used with a HTTP(S) URL, the PUT method is used.
42
43You can specify one --upload-file for each URL on the command line. Each
44--upload-file + URL pair specifies what to upload and to where. curl also
45supports "globbing" of the --upload-file argument, meaning that you can upload
46multiple files to a single URL by using the same URL globbing style supported
47in the URL.
48
49When uploading to an SMTP server: the uploaded data is assumed to be RFC 5322
50formatted. It has to feature the necessary set of headers and mail body
51formatted correctly by the user as curl does not transcode nor encode it
52further in any way.
53