Multi-Part Content-Type not enforced by parser in TemplateHTMLRenderer #8068
-
Y'all this is killing me. Backend browsable API works fine to Post/Put form content with a file. Frontend TemplateHTMLRenderer form works fine until you want to add a file. Then the error is: [ErrorDetail(string='The submitted data was not a file. Check the encoding type on the form.', code='invalid')] A look at the request shows that the request contains no file data (but the POST does contain the filename), and the CONTENT_TYPE is 'application/x-www-form-urlencoded' and not multipart. I've tried explicitly declaring the MultiPartParser in the Post/Put, with no luck. Latest versions of DRF and Django. What else am I missing? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Leaving the answer here for others. After days of fighting with it... and staring at everything... I explicitly declared enctype='multipart/form-data' in the HTML template tag ... bingo! |
Beta Was this translation helpful? Give feedback.
Leaving the answer here for others. After days of fighting with it... and staring at everything... I explicitly declared enctype='multipart/form-data' in the HTML template
tag ... bingo!