Django Rest Framework: Upload file via AJAX

后端 未结 1 932
没有蜡笔的小新
没有蜡笔的小新 2021-01-20 15:43

I have a view and serializer:

class UserView(generics.RetrieveUpdateAPIView):
    model = get_user_model()
    serializer_class = UserProfileSerializer
    p         


        
1条回答
  •  余生分开走
    2021-01-20 16:42

    Ok, I can't exactly explain why, but it seems like var formData = new FormData($(this)); is not enough alone, it needs to be explicitly appended, because reasons? If anyone can explain, please do.

    The working code:

    0 讨论(0)
提交回复
热议问题