Django Rest Framework ImageField

后端 未结 5 1816
旧巷少年郎
旧巷少年郎 2020-12-07 18:54

I can not save the image in this ImageField.

when sending data back:

{
    \"image\": [\"No file was submitted. Check the encoding t         


        
5条回答
  •  渐次进展
    2020-12-07 19:26

    You seem to be missing the request.FILES argument to the serializer constructor in the your post and put handlers.

    serializer = PhotoSerializer(data=request.DATA, files=request.FILES)
    

提交回复
热议问题