title: Django REST Framework file upload causing an "Unsupported media type 'multipart/form-data'" error
body: <p>I am newbie in Django and Django REST Framework. I have the following serializer class which I am using to upload a file along other information. But, while I run the API endpoint with uploaded file, the result is something like this:</p>
  
  <pre><code>HTTP 415 Unsupported Media Type
  Allow: POST, OPTIONS
  Content-Type: application/json
  Vary: Accept
  
  {
      "detail": "Unsupported media type \"multipart/form-data; boundary=----WebKitFormBoundaryybZ07gjZAqvcsZw3\" in request."
  }
  </code></pre>
  
  <p>I tried hard by googling to solve this issue, but cannot come out in a solution, so here is my serializer and API views.</p>
  
  <p>Serializer:</p>
  
  <pre><code>class ExampleSerializer(serializers.Serializer):
  
      example_id = serializers.IntegerField()
      description = serializers.CharField(allow_blank=True)
      example_file = serializers.FileField(allow_empty_file=True)
  
      def create_requirement_line(self):
          request = self.context['request']
  
          requirement_line = ExampleService().example_method(
              example_id=self.validated_data['example_id'],
              description=self.validated_data['description'],
              example_file=self.validated_data['example_file']
      )
      return requirement_line
  </code></pre>
  
  <p>View:</p>
  
  <pre><code> class RequirementLineAPIView(BaseCreateAPIView):
  
      serializer_class = ExampleSerializer
      parser_classes = (FormParser,)
  
      def post(self, request, format=None,*args, **kwargs):
          serializer = self.get_serializer(data=request.data)
  
          if serializer.is_valid():
              try:
                  example_variable = serializer.example_method()
                  return Response(example_variable, status=status.HTTP_200_OK)
  
              except ValidationError as e:
                  return Response(e.message, status=status.HTTP_400_BAD_REQUEST)
  
          return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST)    
  </code></pre>