简体   繁体   中英

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?

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 .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM