C
C#β€’2y ago
Adel

❔ Http post

Hello guys My issue is when I click submit I get This page isn’t working right now If the problem continues, contact the site owner. HTTP ERROR 415 Wasnt sure if my code wasn't correct wanted to ask Thank you 😊
6 Replies
Jimmacle
Jimmacleβ€’2y ago
415 Unsupported Media Type - HTTP | MDN
The HTTP 415 Unsupported Media Type client error response code indicates that the server refuses to accept the request because the payload format is in an unsupported format.
Adel
AdelOPβ€’2y ago
I saw that but didn't know what's unsupported the only thing maybe is my image But my form is only taking title as an input just to test Image on visual style is byte while on sql it's varbinary
mr_technocal
mr_technocalβ€’2y ago
415 means the client sent content that the server doesn't support. What did the client send? APIs typically only support application/json. This appears to be a UI controller. In order for a HTML form to post a file to the server, it must be a multipart, MIME encoded document. This is required because the first part is the input form values and the second part is the actual file content. These are completely different media types. The server needs to know how to handle that.
Angius
Angiusβ€’2y ago
Screenshot of a screenshot has to be a new low in posting code If you're sending a form, you want a [FromForm] attribute [FromBody] handles the application/json media type You're sending x-form-urlencoded
Adel
AdelOPβ€’2y ago
Sorry about that I think the error is coming from the frombody cause it's changing it to json So should I change it to x-form or fromfoem Thank you for your help πŸ™‚πŸ™‚
Accord
Accordβ€’2y ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.
Want results from more Discord servers?
Add your server