I want to upload, process and discard a JSON file without saving it in a database.
views.py
parser_classes(['FileUploadParser'])
@api_view(['POST'])
def upload_file(request):
file = request.FILES.get('file')
# process the file
return JsonResponse('status':'successful')
urls.py
urlpatterns = [
path('api/upload_file/', views.upload_file),
]
I am setting the header as Content-Type: multipart/form-data
Then it is showing the error "Multipart form parse error - Invalid boundary in multipart: None"
What is the correct way of uploading a JSON file in DRF ?
Python version : 3.6.9
Django version : 3.2.3