Click here to Skip to main content
15,938,325 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
give the error while saving the image(invalid content "application/json").

What I have tried:

var files=HttpContext.Request.Form.File;
Updated 12-Feb-23 3:24am
Andre Oosthuizen 10-Feb-23 2:08am    
It is impossible for us to even start working out where your error came from as we cannot see what you see. Please use the 'Improve Question' to post more code, on which line did the error occur, what output do you want with your code, what output are you getting now etc.

1 solution

If you are using 'HttpContext.Request.Form.Files' to retrieve uploaded files from a client, then the error "invalid content 'application/json'" may be caused by the request not being properly formatted as a multipart/form-data request.

Make sure that your client is properly setting the Content-Type header to multipart/form-data and that the request body is properly formatted with the file data.
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900