[Fixed]-PUT request for image upload not working in django rest


Removing the content-type from the headers resolves this.


Your error is telling you that the boundary for your multipart/form-data content of your request is invalid – in particular that is is None. This, by design, returns a 400 (“Bad Request”) response code. The Error is raised here in the django code.

To enter that code branch with boundary equal to None means that the boundary option is not specified in the content-type header of your request.

boundary must be specified when using multipart/form-data in content-type as specified in RFC2046 (referred to by RFC2388) – in particular section 5.1.1

The Content-Type field for multipart entities requires one parameter,

You say it has worked before, so you should check the code that you are using to make the request – something must have changed to mean that the boundary is not specified in the content-type.

N.B. I presume the request is code-generated, as <form method="put"> is invalid HTML and so a request generated by a browser given that HTML would be a GET rather than a PUT.


You will typically want to use both FormParser and MultiPartParser together in order to fully support HTML form data.


Leave a comment