Django MultiPartParserError

I am trying to send image to the django server. Here is my code:

def classify_image(request):
    if request.method == 'POST' and request.FILES:
            image = request.FILES['file']
            if image:
                img_b64 = b64encode(
                res = main.classify_image(img_b64)
                return JsonResponse({
                    "status": "ok",
                    "result": {
                        "class": res[0],
                        "confidence": res[1],
        except Exception as e:
            return JsonResponse({
                "status": "error",
                "error": str(e)

    return JsonResponse({
        "status": "error",
        "error": "Image file is required"

But I keep on getting Error image

I am sending requesting using postman, here's the sample postman 1 postman 2

The weird thing is the code was working perfectly fine some hours ago. Later I didn't change a single thing but it was throwing error.

Back to Top