I've just started messing around with Django REST today and wanted to create a PUT endpoint for a photo upload. The image is then to be saved to a local folder. I'm using the MultiPartParser but request.data and request.FILES are both empty? Anyone know how why that might be?
Views.py:
class ImageUploadView(APIView):
queryset = Image.objects.all()
parser_classes = (MultiPartParser,)
def put(self, request, filename, format=None):
print(request.FILES)
return Response(status=204)
models.py
class Image(models.Model):
file = models.ImageField(upload_to=user_directory_path)
date_added = models.DateTimeField(auto_now_add=True)
Here is my postman test enter image description here