❔ I want to create post which contain image and still stuck in this shit 3 days, help me :((
I have tested in postman but it always return 415 error
18 Replies
Your postman request is sending
Content
while you expect PostContent
That's the only thing that immediately stands out.Im in the road so when i go home, i will check it again, thanks u
also postman is using this URI
the only route I see that accepts
POST
is on /
but it's a little hard to tell with the collection of screenshotsi forgot to screenshot the mapgroup
it still return that shitting error :(((
can i give you my github project link so you can fork it and help me :((
like 95% of what I work on is C++.
I only use C# when it's a requirement.
i still learning but this is first time i can not fix the error when i try so hard to search in everything
https://github.com/khauvannam/BlogProject.Server.git
if you see any error, please help me fix it ;((
GitHub
GitHub - khauvannam/BlogProject.Server
Contribute to khauvannam/BlogProject.Server development by creating an account on GitHub.
don't commit your
bin
folder
there's a bunch of stuff that is unclear to me
why are you not sending a body, it would be the post content
also what is the content type of this post? html?I think i sending the body
So what should i do next?
Sorry i am still a newbie, so what should i do next?
Just ignore bin/** and obj folder
ok but you understand it shouldn't be there in the first place
it makes downloading the project from 30 KB to like 8 MB
it's like 300x the size
i would ask you describe what the CreatePost api should do
send the post? send post + attachments? and in which format: multipart, json...
are there requirements or are you building it from scratch
Send the post + attachment, the attachment will be store in my azure blob
Then respone the content, id, and the url of my blob file
Multipart form, it will return an json which i can use for my frontend
I build it from scratch
[hopefully i can sand messages now]
using multipart would be more involved
if you search how to read multipart from c# you'll find articles
even from microsoft
https://learn.microsoft.com/en-us/aspnet/web-api/overview/advanced/sending-html-form-data-part-2
Sending HTML Form Data in ASP.NET Web API: File Upload and Multipar...
This tutorial shows how to upload files to a web API. It also describes how to process multipart MIME data.
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.