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