httpie / cli

🥧 HTTPie CLI — modern, user-friendly command-line HTTP client for the API era. JSON support, colors, sessions, downloads, plugins & more.
https://httpie.io
BSD 3-Clause "New" or "Revised" License
33.37k stars 3.67k forks source link

how can I upload a file from windows platform #254

Closed beepony closed 10 years ago

beepony commented 10 years ago

Hi,Thanks for your httpie,it helps me a lot. Now I have a question ,eg: I have a picture in C:\Users\beep\1.png,how can I upload a file from windows platform . I don't find the right command.

Thanks and sorry for my poor English

jkbrzt commented 10 years ago

This is how:

$ http   example.org/path   @C:\Users\beep\1.png

You'll need to update to current master though, via:

$ pip install --upgrade https://github.com/jakubroztocil/httpie/tarball/master
beepony commented 10 years ago

Thanks a lot,I just try to do it ,and it seems does'nt work .the command like this: http -a username:password v0.api.upyun.com/file-bin @C:\Users\beep\1.png the error info like this:

所在位置 行:1 字符: 53
+ http -a opr10000:opr10000 v0.api.upyun.com/file-bin  <<<< @C:\Users\beep\1.png
    + CategoryInfo          : ParserError: (:) [], ParentContainsErrorRecordException
    + FullyQualifiedErrorId : UnrecognizedToken

the chinese means can not recognise the character in line 1

jkbrzt commented 10 years ago

This is an error specific to your shell. I would guess that the @ has a special meaning for it. Try putting the path into quotes:

http -a username:password v0.api.upyun.com/file-bin '@C:\Users\beep\1.png'
beepony commented 10 years ago

Thanks a lot, I got 403 Access denied, and I checked my username and password, it's right . I was confused. error

jkbrzt commented 10 years ago

This looks like an unrelated auth issue. Make sure you have the right permissions.

(btw., I strongly advise you to change your password now as it's trivial to recover from the Authorization header that is included in the screenshot)

beepony commented 10 years ago

so kind of you, thanks again~ :)

beepony commented 10 years ago

Hi, I found the reason, file-bin is not a file, it's a bucket name.I should add an file in URI,

http -a username:password v0.api.upyun.com/file-bin/1.png '@c:\Users\beep\1.png'
jkbrzt commented 10 years ago

Glad you have figured that out :+1: