[Django]-Django REST FileUpload serializer returns {'file': None}

6πŸ‘

βœ…

It would be helpful to see how you are uploading the file. If you are using a multipart/form-data request and providing the json for β€œfile” properly, the most likely thing is that the file is failing validation for some reason.

If you can, it might also be helpful to test from the browsable api (as that guarantees nothing is wrong with your request).

Edit:
The issue was that the validated_data field should be used instead of the data field after calling is_valid().

Leave a comment