Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is curl's --upload-file a post request?

Tags:

post

curl

I'm a little bit confused about curl's "--upload-file" argument. The man-page just states that it "transfers the specified local file to the remote URL.".

Is this a post request? If no, what is it then and how would this look like in an actual HTML5 client app?

like image 299
OddDev Avatar asked Nov 19 '16 10:11

OddDev


People also ask

What does curl -- upload file do?

CURL upload file allows you to send data to a remote server. The command-line tool supports web forms integral to every web system. When you execute a CURL file upload [1] for any protocol (HTTP, FTP, SMTP, and others), you transfer data via URLs to and from a server.

How do I post a file using curl?

To post a file with Curl, use the -d or -F command-line options and start the data with the @ symbol followed by the file name. To send multiple files, repeat the -F option several times.

How do I upload files to MediaWiki?

Upload file contents directly, using the file parameter. Upload the file in pieces, using the filesize , chunk , and offset parameters. Have the MediaWiki server fetch a file from a URL, using the url parameter. Complete an earlier upload that failed due to warnings, using the filekey parameter.


1 Answers

It is a PUT request.

From the manual (-T is single-dashed for --upload-file):

Upload all data on stdin to a specified HTTP site:

curl -T - http://www.upload.com/myfile

Note that the HTTP server must have been configured to accept PUT before this can be done successfully.

For other ways to do HTTP data upload, see the POST section below.

like image 89
Qrchack Avatar answered Oct 11 '22 07:10

Qrchack