Upload File using Django Rest Framework

后端 未结 2 1007
夕颜
夕颜 2021-02-09 06:07

I am new to django. Can anybody help me... How can I upload a file using the Rest Framework API ?

I have tried following this page:

http://www.django-rest-framew

2条回答
  •  南方客
    南方客 (楼主)
    2021-02-09 06:36

    Zhe answer is pretty well. Besides, you can add some parameters in order to see the response. Take this one for example:

    curl -X PATCH --dump-header - -H "Content-Type:multipart/form-data" -u jorge:123456 -F "image=@/home/oscar/Pictures/dgnest/_MG_6445.JPG;type=image/jpeg" http://localhost:8000/api/project/3/
    

提交回复
热议问题