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