Dr_Oldwarez
Dr_Oldwarez

Reputation: 11

Switching from CURL to HTTPie. Equivalent of CURL -T

I am working with cURL which is integrated into an xBase program.

And the curl command line by me includes the option -T to download a local file to a CalDAV calendar. I tried to find it in HTTPie, but I did not find an equivalent command. Does HTTPie have such an option as -T in cURL?

Upvotes: 1

Views: 601

Answers (1)

Batuhan Taskaya
Batuhan Taskaya

Reputation: 235

From cURL's manual:

       -T, --upload-file <file>
              This transfers the specified local file to the remote URL.

It seems you are looking for the upload functionality. In HTTPie, depending on what the host server is expecting, you have multiple ways to upload a file:

A) Redirected input:

$ http PUT httpbin.org/put Content-Type:image/png < /images/photo.png

B) Request data from a filename (automatically sets the Content-Type header):

$ http PUT httpbin.org/put @/images/photo.png

C) Form file upload:

$ http --form PUT httpbin.org/put photo=@/images/photo.png

Original answer by Jakub Roztocil.

Upvotes: 1

Related Questions