Correct the encoding type in the form in the CURL command when submitting to django-rest-api
I am using django-rest-framework and have a model that only has a file-field. I created serializer and views and everything else. Everything seems to work correctly because when using the web-api I can upload the file without any problem. But when trying to use CURL to check it, I always get
{"data": ["File not sent. Please check the encoding type in the form." ]}%
I have tried many commands, but they all end up in this error message. The commands I've tried where:
curl -H "Content-Type:multipart/form-data" -u stefan:stefan -F "data=/home/erdi/Videos/search4.webm" http://127.0.0.1:8000/restapp/sportvideosupload/
curl -X POST -S -H 'Content-Type: application/json' -u "stefan:stefan" --data-binary '{"data":"/home/erdi/Videos/search2.webm"}' 127.0.0.1:8000/restapp/sportvideosupload/
curl -X POST -H "Content-Type:multipart/form-data" -u stefan:stefan -F "data=/home/erdi/Videos/search2.webm;type=video/webm" http://127.0.0.1:8000/restapp/sportvideosupload/
As I start to use the anxiety apis, I hope that perhaps one of you has some suggestions on what I am doing wrong.
+3
source to share
No one has answered this question yet
Check out similar questions: