I used to face this issue if the header 'Content-Type': 'application/json' is not added. Also refer POST JSON fails with 415 Unsupported media type, Spring 3 mvc, around the same lines.
It was because there was no accept header sent with the request. You need to send a
Content-Type headers with the client code.
Since your application accepted json, It should be
<code>'Accept': 'application/json'</code> <code>'Content-Type': 'application/json'</code>
Check out some possible reasons here: http://javahonk.com/415-unsupported-media-type/
In my case, I received the HTTP 415 Unsupported Media Type response, since I specified the content type to be TEXT and NOT JSON, so simply changing the type solved the issue. Please check the solution in more detail in the following blog post: https://www.howtodevelop.net/article/20/unsupported-media-type-415-in-aspnet-core-web-api
use formdata.append('file', JSON.stringify(file));