Search code examples
djangodjango-rest-frameworkhttpie

Django upload Photo via Httpie


I'm using DRF 2.3.13 , I want to upload photos by typing from terminal, so I use Httpie.

But I got MultiValueDict: {} , empty.

Am I missing the headers="multipart/form-data" ??

If true, so how to set the headers in Httpie??

Ex: I've sent it , but still get empty.

http -f -a username:password localhost:8000/photo/ FILES="path_to_image" author="AUTHOR" -h {'Content-Type':"multipart/form-data"}

tks for taking a look at this.


Solution

  • http -f -a username:password :8000/photo/ FILES@path_to_image author="AUTHOR"
    

    See Request items and File upload forms for more details.