Sample Header Ad - 728x90

How to upload a file using http PUT with httpie?

2 votes
1 answer
4323 views
For some webserver testing, I use curl for file upload like this: $ curl --silent --digest --user user:pass --upload-file filename http://server/dir/ Now I tried to archive the same function but with usage of httpie. Tried something like: $ http --auth-type digest --auth user:pass PUT http://server/dir/ but cannot find a parameter to pass a filename for upload. Trying e.g. this $ http --auth-type digest --auth user:pass PUT http://server/dir/ A=B has the consequence that the content {"A": "B"} will be passed as http request body, but I want to pass the raw content of a (maybe binary) file as request body instead (like possible with curl). Might there be a way to do this also using httpie? (I'd tested with httpie 0.9.2 on Kubuntu 16.04 host.)
Asked by Joe (809 rep)
Sep 22, 2017, 12:36 AM
Last activity: Apr 22, 2020, 12:04 AM